Sign In to the Service

Each time your application starts working with the MYOB Advanced contract-based REST service, you have to sign in to MYOB Advanced. To sign in to MYOB Advanced, you access the needed URL with the POST HTTP method and pass the credentials in the request body. See details on the request and the response in the following sections.

Note: Instead of directly signing in to MYOB Advanced, your application can use the OAuth 2.0 authorization. For details about OAuth 2.0, see Authorizing Client Applications to Work with MYOB Advanced.

HTTP Method and URL

When you need to sign in to MYOB Advanced, you use the POST HTTP method and the following URL.

POST http://<MYOB Advanced instance URL>/entity/auth/login

You replace <MYOB Advanced instance URL> with the URL of your MYOB Advanced instance.

For example, suppose that you want to sign in to a local MYOB Advanced instance with the name AcumaticaDB. You should use the following HTTP method and URL.

POST http://localhost/AcumaticaDB/entity/auth/login

Parameters

You use no parameters when you sign in to MYOB Advanced.

Request Headers

You can specify the following header in the request.

Header Description
Content-Type Specifies the format of the request body, which can be one of the following:
  • application/json
  • application/xml
  • text/xml
  • application/x-www-form-urlencoded

Request Body

In the request body, you pass the credentials for accessing MYOB Advanced in JSON format, as shown in the following example.
{
  "name" : "admin",
  "password" : "123",
  "tenant" : "MyStore",
  "branch" : "MYSTORE",
  "locale" : "EN-US"
}
You specify the values of the parameters as follows:
  • name: The username that the application should use to sign in to MYOB Advanced, such as "admin".
  • password: The password for the username, such as "123".
  • tenant: The name of the tenant to which the application should sign in, such as "MyStore". You can view the name that should be used for the tenant in the Login Name box of the Tenants (SM203520) form.
  • branch: The ID of the branch to which the application should sign in. You can view the ID of the branch in the Branch ID box of the Branches (CS102000) form.
  • locale: The locale that should be used in MYOB Advanced. You should specify the locale in the System.Globalization.CultureInfo format converted to string, as with "EN-US".
    Note: This parameter has been developed for future use. You do not need to set its value.

Response Status Codes

The following table lists the HTTP status codes that the system returns for a sign-in request.

Code Description
204 The request has been completed successfully. The response headers contain the cookies that authorize the user to make further requests.
400

The data specified in the request is invalid.

429

The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users).

500

An internal server error has occurred.

Example

The following request shows an example of a sign in to MYOB Advanced through the REST API.
Tip: In the request example below, <MYOB Advanced instance URL> is the URL of the MYOB Advanced instance (such as https://my.acumatica.com/MyInstance). You can omit the instance name in the URL (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
POST /entity/auth/login HTTP/1.1
Host: [<MYOB Advanced instance URL>]
Accept: application/json
Content-Type: application/json

{
   "name" : "admin",
   "password" : "123",
   "tenant" : "MyTenant",
   "branch" : "HEADOFFICE"
}

Usage Notes

For each attempt to sign in to MYOB Advanced as described in this topic, you must implement the signing out from the service after you finish your work with MYOB Advanced to close the session. For details about the signing out, see Sign Out from the Service.

You should also take into account MYOB Advanced license API limits. For details, see License Restrictions for API Users.