Authetication.
Authentication variables.
The ASAP API requires authentication using a POST request. Clients must send their credentials in the body of the request in JSON format. The server will respond with an access token, which must be included in all subsequent requests.
Endpoint
POST https://stagingapi.asapconnected.com/api/login
Request Format
The POST request must include the following parameters in the JSON body:
- apiKey: Your API key.
- user: Your username for the integration application.
- organizationId: The organization ID for authentication.
- password: Your password for the integration application.
Example Request
POST /api/login HTTP/1.1
Host: stagingapi.asapconnected.com
Content-Type: application/json
Accept: application/json
{
"apiKey": "your_api_key",
"user": "your_username",
"organizationId": "your_organization_id",
"password": "your_password"
}
Response
The server responds with an HTTP 200 status code if the authentication is successful. The response contains an access token in the asap_accesstoken
header.
Example Response
HTTP/1.1 200 OK
asap_accesstoken: your_access_token
Content-Type: application/json
Token expiration time
The access token has a 2-hour lifespan, after which it expires and is rejected. You will need to create a new access token.
Access token
Once you get the access token, you need to send it every time you make a request in the headers.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://stagingapi.asapconnected.com/api/invoice(1000)/summary");
request.Headers.Add("asap_accesstoken", "access_token");
request.Accept = "application/json";
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
string accessToken = response.Headers["asap_accesstoken"];
Top