| POST | /api/authentication/token | Get Bearer access token, contact support for credentials |
|---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
/**
* Auth
*/
@Api(Description="Auth")
@ApiResponse(Description="Access token response", IsDefaultResponse=true, StatusCode=200)
public static class GetAuthToken
{
/**
* Post parameters in body
*/
@ApiMember(Description="Post parameters in body", ParameterType="model")
public String clientId = null;
/**
* Post parameters in body
*/
@ApiMember(Description="Post parameters in body", ParameterType="model")
public String clientSecret = null;
/**
* Post parameters in body
*/
@ApiMember(Description="Post parameters in body", ParameterType="model")
public String scope = null;
public String getClientId() { return clientId; }
public GetAuthToken setClientId(String value) { this.clientId = value; return this; }
public String getClientSecret() { return clientSecret; }
public GetAuthToken setClientSecret(String value) { this.clientSecret = value; return this; }
public String getScope() { return scope; }
public GetAuthToken setScope(String value) { this.scope = value; return this; }
}
public static class AccessTokenResponse
{
public String accessToken = null;
public String scope = null;
public String tokenType = null;
public Integer expiresIn = null;
public Integer httpStatusCode = null;
public String httpErrorReason = null;
public String error = null;
public String getAccessToken() { return accessToken; }
public AccessTokenResponse setAccessToken(String value) { this.accessToken = value; return this; }
public String getScope() { return scope; }
public AccessTokenResponse setScope(String value) { this.scope = value; return this; }
public String getTokenType() { return tokenType; }
public AccessTokenResponse setTokenType(String value) { this.tokenType = value; return this; }
public Integer getExpiresIn() { return expiresIn; }
public AccessTokenResponse setExpiresIn(Integer value) { this.expiresIn = value; return this; }
public Integer getHttpStatusCode() { return httpStatusCode; }
public AccessTokenResponse setHttpStatusCode(Integer value) { this.httpStatusCode = value; return this; }
public String getHttpErrorReason() { return httpErrorReason; }
public AccessTokenResponse setHttpErrorReason(String value) { this.httpErrorReason = value; return this; }
public String getError() { return error; }
public AccessTokenResponse setError(String value) { this.error = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/authentication/token HTTP/1.1
Host: stf-api-uat.data-xchange.co.za
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
clientId: String,
clientSecret: String,
scope: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
accessToken: String,
scope: String,
tokenType: String,
expiresIn: 0,
httpStatusCode: 0,
httpErrorReason: String,
error: String
}