API Operations

API authentication

login

Overview

This method has to be called before any other, to retrieve an authentication token that allows the other API calls to be authorized.

This method requires an username and password to be passed, and gives you an authentication token for the current user.

The authentication token needs to be passed as a HTTP authorization header in the form:

Authorization: Token token=<your-authentication-token>

Request

endpoint
/api/v1/login.[format]
http method
GET

format must be either json or xml

Required Parameters

None

Optional Parameters

None

Response

Response is a list of all the entities visible by the user. Each entry has the following attributes:

auth_token
authorization token for the current user

This is a sample response in JSON format:

{"auth_token": "your-authentication-token"}

Examples

In each sample below, you have to substitute values between angular brackets (< and >) with the correct input data.

cUrl

curl -u email@domain.com:password https://www.myo.io/api/v1/login.json

Ruby (with rest_client)

require 'rest_client'
RestClient::Request.new(:method => "get", :url => 'https://www.myo.io/api/v1/login.json', :user => "email@domain.com", :password => "password", :headers => { :accept => :json, :content_type => :json}).execute