1. Create a new Application

First of all you need to register a new application so you can get the client id and the client secret.

2. Authenticat yourself

Most of the TagMyCode API calls needs authentication. OAuth 2 is the only way to authenticate you requests.

Obtain Access Token

Redirect user to login page opening this link in browser

https://tagmycode.com/oauth2/authorize?client_id=CLIENT_ID&response_type=code&redirect_uri=https://example.com/callback

A successful authorization will pass the client the authorization code in the URL via the supplied redirect_uri

https://example.com/callback?code=AUTHORIZATION_CODE

Now you can request a token with the authorization code

curl -k -u CLIENT_ID:CLIENT_SECRET "https://tagmycode.com/oauth2/token" -d 'grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=https://example.com/callback'

The response will show you the access token in JSON format

{"access_token":"613f45bf0e2dc034d29b84041c06d766c93a476d","expires_in":86400,"token_type":"Bearer","scope":null,"refresh_token":"5a7941349c9601deba50a885733370d76a69c2ae"}

3. Make a signed API call

After the authentication we want to test if everything works fine, for example we can make a call to /account resource

curl -k "https://api.tagmycode.com/account?access_token=ACCESS_TOKEN" 

The response to this call should looks like this

{
  "id":"1",
  "username":"nedstark",
  "firstname":"Eddard",
  "lastname":"Stark",
  "email":"ned.stark@winterfell.north",
  "locale":"en",
  "timezone":"GMT",
  "registration_date":"2010-03-05 16:48:19",
  "activation_date":"2010-03-10 12:54:44",
  "status":"active"
}