POST | /v1/login | Process GAS Authentication |
---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
public static class LoginRequest implements IPost
{
/**
* GAS AuthCode
*/
@ApiMember(Description="GAS AuthCode")
public String AuthCode = null;
/**
* GAS ErrorCode
*/
@ApiMember(Description="GAS ErrorCode")
public String ErrorCode = null;
/**
* Client Id
*/
@ApiMember(Description="Client Id")
public String ClientId = null;
/**
* Secret
*/
@ApiMember(Description="Secret")
public String Secret = null;
/**
* Callback Url
*/
@ApiMember(Description="Callback Url")
public String CallbackUrl = null;
/**
* Redirect Url
*/
@ApiMember(Description="Redirect Url")
public String RedirectUrl = null;
public String getAuthCode() { return AuthCode; }
public LoginRequest setAuthCode(String value) { this.AuthCode = value; return this; }
public String getErrorCode() { return ErrorCode; }
public LoginRequest setErrorCode(String value) { this.ErrorCode = value; return this; }
public String getClientId() { return ClientId; }
public LoginRequest setClientId(String value) { this.ClientId = value; return this; }
public String getSecret() { return Secret; }
public LoginRequest setSecret(String value) { this.Secret = value; return this; }
public String getCallbackUrl() { return CallbackUrl; }
public LoginRequest setCallbackUrl(String value) { this.CallbackUrl = value; return this; }
public String getRedirectUrl() { return RedirectUrl; }
public LoginRequest setRedirectUrl(String value) { this.RedirectUrl = value; return this; }
}
public static class LoginResponse
{
public String RedirectUrl = null;
public Boolean IsAuthenticated = null;
public String UserToken = null;
public String UserId = null;
public ArrayList<Integer> UserRoleId = null;
public String DefaultRetailer = null;
public LoginStatus LoginStatus = null;
public String UserRoleRedirect = null;
public String DefaultVehicleType = null;
public ArrayList<String> EntitlementGroup = null;
public String getRedirectUrl() { return RedirectUrl; }
public LoginResponse setRedirectUrl(String value) { this.RedirectUrl = value; return this; }
public Boolean getIsAuthenticated() { return IsAuthenticated; }
public LoginResponse setIsAuthenticated(Boolean value) { this.IsAuthenticated = value; return this; }
public String getUserToken() { return UserToken; }
public LoginResponse setUserToken(String value) { this.UserToken = value; return this; }
public String getUserId() { return UserId; }
public LoginResponse setUserId(String value) { this.UserId = value; return this; }
public ArrayList<Integer> getUserRoleId() { return UserRoleId; }
public LoginResponse setUserRoleId(ArrayList<Integer> value) { this.UserRoleId = value; return this; }
public String getDefaultRetailer() { return DefaultRetailer; }
public LoginResponse setDefaultRetailer(String value) { this.DefaultRetailer = value; return this; }
public LoginStatus getLoginStatus() { return LoginStatus; }
public LoginResponse setLoginStatus(LoginStatus value) { this.LoginStatus = value; return this; }
public String getUserRoleRedirect() { return UserRoleRedirect; }
public LoginResponse setUserRoleRedirect(String value) { this.UserRoleRedirect = value; return this; }
public String getDefaultVehicleType() { return DefaultVehicleType; }
public LoginResponse setDefaultVehicleType(String value) { this.DefaultVehicleType = value; return this; }
public ArrayList<String> getEntitlementGroup() { return EntitlementGroup; }
public LoginResponse setEntitlementGroup(ArrayList<String> value) { this.EntitlementGroup = value; return this; }
}
public static enum LoginStatus
{
Authenticated,
NotAuthenticated,
Error;
}
}
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 /v1/login HTTP/1.1
Host: prod-api-auth-mb-dhc.rapp-customers.co.uk
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
AuthCode: String,
ErrorCode: String,
ClientId: String,
Secret: String,
CallbackUrl: String,
RedirectUrl: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { RedirectUrl: String, IsAuthenticated: False, UserToken: String, UserId: String, UserRoleId: [ 0 ], DefaultRetailer: String, LoginStatus: Authenticated, UserRoleRedirect: String, DefaultVehicleType: String, EntitlementGroup: [ String ] }