This guide provides a step-by-step process to authenticate with and fetch product data from the AIM-POS API using a paginated approach.
AIM-POS API access requires a two-step OAuth authentication flow to obtain the necessary tokens for subsequent requests.
Prerequisites:
- Your unique
APIKey - An
AppId(an identifier for your application/integration) - Valid AIM user credentials (
UserNameandPassword)
This initial request retrieves the correct API endpoint domain and an OAuthToken required for the next step.
- Method:
GET - URL:
https://aim-ae.com/aeservices30/api/GetEndPoint - Headers:
APIKey: <Your_APIKey>AppId: <Your_AppId>
Example Response:
{
"NewEndpointDomain": "https://your-unique-endpoint.aim-ae.com",
"OAuthToken": "your_oauth_token_here",
"Status": {
"StatusCode": "Ok"
}
}- Note: Extract and save the
NewEndpointDomainandOAuthTokenvalues from this response.
Use the endpoint and token from Step 1 to request a final access Token.
- Method:
POST - URL:
{NewEndpointDomain}/Api/Security - Headers:
APIKey: <Your_APIKey>OAuthToken: <OAuthToken_from_Step_1>
- Query Parameters:
AppId=<Your_AppId>UserName=<Your_Username>Password=<Your_Password>
Example Response:
{
"Token": "your_final_access_token_here",
"Status": {
"StatusCode": "Ok"
}
}- Note: This
Tokenis required for all subsequent data requests. Manage its lifecycle according to the API's expiration policy.
To retrieve products, use the GetActiveE3Party endpoint. The API implements pagination; you must loop through the data by adjusting the startOffset parameter until all records are fetched.
Pagination Logic:
-
Set
recordCount=150(the maximum recommended records per call). -
Start with
startOffset=0. -
If the number of
Recordsreturned is less than 150, you have reached the last page. -
If 150 records are returned, increment the
startOffsetby 150 and make the next request (e.g.,startOffset=150, then300, etc.). -
Method:
GET -
URL:
{NewEndpointDomain}/api/GetActiveE3Party -
Headers:
APIKey: <Your_APIKey>OAuthToken: <OAuthToken_from_Step_1>AppId: <Your_AppId>Token: <Token_from_Step_2>
-
Query Parameters:
InventoryType=InventoryWebCategory=null(or a specific category if needed)recordCount=150startOffset=<Offset_Value>
Example Request (cURL):
curl --location 'https://your-unique-endpoint.aim-ae.com/api/GetActiveE3Party?InventoryType=Inventory&WebCategory=null&recordCount=150&startOffset=0' \
--header 'APIKey: YOUR_API_KEY' \
--header 'OAuthToken: OAUTH_TOKEN_FROM_STEP_1' \
--header 'AppId: YOUR_APP_ID' \
--header 'Token: ACCESS_TOKEN_FROM_STEP_2'Example Response:
{
"StartOffset": 0,
"RecordCount": 1,
"Records": [
{
"Sku": "1001",
"Desc": "Bronze Widget",
"Barcode": "873750123456",
"Our_Price": 49.0,
"Qty_Available": 0.0
}
],
"Status": {
"StatusCode": "Ok"
}
}- Error Handling: Always check the
Status.StatusCodein the response before processing data. Implement robust error handling for network issues, authentication failures, and rate limiting. - Token Management: The
Tokenfrom Step 2 may have a limited lifespan. Implement logic to detect an expired token (e.g., via an HTTP 401 error) and re-authenticate from Step 1 without manual intervention. - Performance: Adhere to the pagination limit of 150 records per request to ensure optimal performance and avoid being rate-limited by the API server.