Monetate Auth API
Token
Refresh a Token
code examples curl location 'https //api monetate net/api/auth/v0/refresh/?ttl=3600' \\ \ header 'accept application/json' \\ \ header 'content type application/json'\<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //api monetate net/api/auth/v0/refresh/?ttl=3600', curlopt returntransfer => true, curlopt encoding => '', curlopt maxredirs => 10, curlopt timeout => 0, curlopt followlocation => true, curlopt http version => curl http version 1 1, curlopt customrequest => 'get', curlopt httpheader => array( 'accept application/json', 'content type application/json' ), )); $response = curl exec($curl); curl close($curl); echo $response; var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'get', headers myheaders, redirect 'follow' }; fetch("https //api monetate net/api/auth/v0/refresh/?ttl=3600", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));import requests import json url = "https //api monetate net/api/auth/v0/refresh/?ttl=3600" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("get", url, headers=headers, data=payload) print(response text) require "uri" require "json" require "net/http" url = uri("https //api monetate net/api/auth/v0/refresh/?ttl=3600") https = net http new(url host, url port) https use ssl = true request = net http get new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = https request(request) puts response read body responses // the token was successfully generated { "meta" { "code" 200, "errors" \[ {} ], "warnings" \[ {} ] }, "data" { "issued at" 1481650253 342885, "token" "1 lm45vlvwac5yud5daw\ xatbdkxqi3bf7 043j88scwrzfkzvwcugrknzkek7fu", "expires in" 1000, "expires at" 1481650253 342885 } }// unauthorized the request did not include a token, or the token provided was invalid please ensure that your token is correct and that the authorization header is properly formatted { "meta" { "code" 200, "errors" \[ {} ], "warnings" \[ {} ] }, "data" {} }// forbidden the request included a token that has been revoked please contact your account administrator to generate a new token { "meta" { "code" 200, "errors" \[ {} ], "warnings" \[ {} ] }, "data" {} }// unknown error please try again or contact your account manager for more information { "meta" { "code" 200, "errors" \[ {} ], "warnings" \[ {} ] }, "data" {} }