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 .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<LoginRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Auth.API.ServiceModel">
<AuthCode>String</AuthCode>
<CallbackUrl>String</CallbackUrl>
<ClientId>String</ClientId>
<ErrorCode>String</ErrorCode>
<RedirectUrl>String</RedirectUrl>
<Secret>String</Secret>
</LoginRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <LoginResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Mercedes.Auth.API.ServiceModel"> <DefaultRetailer>String</DefaultRetailer> <DefaultVehicleType>String</DefaultVehicleType> <EntitlementGroup xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:string>String</d2p1:string> </EntitlementGroup> <IsAuthenticated>false</IsAuthenticated> <LoginStatus>Authenticated</LoginStatus> <RedirectUrl>String</RedirectUrl> <UserId>String</UserId> <UserRoleId xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:int>0</d2p1:int> </UserRoleId> <UserRoleRedirect>String</UserRoleRedirect> <UserToken>String</UserToken> </LoginResponse>