This document covers the scope of registering a User with Nitro Commerce and getting their Organisation information, to be further used by your platform user.
You need to call the login API in order to get the bearer token. This token will be used to create the User with the Nitro Commerce.
Call the Register API with the required headers and data to register a Client(User) with the Nitro Commerce.
With every User, an Organisation is auto generated and assigned to that particular user. The same Organisation is also assigned to your Platform User, which can be viewed from the Dropdown provided in the top right corner of the Nitro Commerce Dashboard.
Your Platform User will be able to see the list of Organisations created by them and access those Organisations.
Method: POST
URL: https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/users/login
Data: { "email": "<PLATFORM_ACCOUNT_EMAIL>", "password": "<PLATFORM_ACCOUNT_PASSWORD>" }
Headers:
- Content-Type: application/json
curl --location 'https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/users/login' \
-H 'Content-Type: application/json' \
--data-raw '{ "email": "<PLATFORM_ACCOUNT_EMAIL>", "password": "<PLATFORM_ACCOUNT_PASSWORD>" }'
{
"bearer_token": "<PLATFORM_ACCOUNT_USER_BEARER_TOKEN>",
"user": {
"id": 3,
"name": "<PLATFORM_ACCOUNT_USER_NAME>",
"email": "<PLATFORM_ACCOUNT_EMAIL>",
"username": "<PLATFORM_ACCOUNT_EMAIL>",
"is_active": true,
"phone": "<PLATFORM_ACCOUNT_USER_PHONE>",
"is_email_verified": false,
"is_phone_verified": false,
"is_superuser": false
},
"code": 2001,
"message": "OK"
}
{
"code": 4011,
"message": "Invalid login credentials."
}
Method: POST
URL: https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/users/register
Data: { "email": "<USER_EMAIL>", "name": "<NAME>", "phone": "<USER_PHONE>", "domain": "<ORGANISATION_DOMAIN>", "organisation_name": "<NAME_OF_ORGANISATION>" }
Headers:
- Content-Type: application/json
- Authorization: Bearer <platform_account_user_bearer_token>
curl --location 'https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/users/register' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <platform_account_user_bearer_token>' \
--data-raw '{
"email": "<USER_EMAIL>", "name": "<NAME>", "phone": "<USER_PHONE>, "domain": "<ORGANISATION_DOMAIN>", "organisation_name": "<NAME_OF_ORGANISATION>""
}'
{
"user": {
"id": 3,
"name": "<USER_NAME>",
"email": "<USER_EMAIL>",
"username": "<USER_EMAIL>",
"is_active": true,
"phone": "<USER_PHONE>",
"is_email_verified": false,
"is_phone_verified": false,
"is_superuser": false
},
"organisation": {
"id": <ORGANISATION_ID>,
"token": "<ORGANISATION_TOKEN>",
"name": "",
"domain": "<ORGANISATION_DOMAIN>",
"currency": "",
"country_code": "",
"is_active": true,
"logo": "",
"wid": null,
"created_at": "2024-07-10T09:56:21.863123+00:00",
"modified_at": "2024-07-10T09:56:21.862801+00:00",
"referer": null,
"features_enabled": ""
},
"code": 2011,
"message": "Created"
}
User:
{
"code": 4009,
"message": "Email Already exists"
}
Organisation:
{
"code": 40010,
"message": "Organisation Exists. Cannot assign existing Organisations."
}
Method: POST
URL: https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/integration
Data: {"org_id":<organisation_id>,"active":true,"type":"WEBHOOK","data":{"endpoint":"https://somewebhook.com","authToken":"abXXefg","httpTimeout":"3","do_events":true,"do_contacts":true}}
Headers:
- Content-Type: application/json
- Authorization: Bearer <platform_account_user_bearer_token>
curl 'https://svc.nitrocommerce.ai/v1/rest/integration' \
-X 'POST' \
-H 'Authorization: Bearer <platform_account_user_bearer_token>' \
-H 'Content-Type: application/json' \
--data-raw '{"org_id":<organisation_id>,"active":true,"type":"WEBHOOK","data":{"endpoint":"https://somewebhook.com","authToken":"abXXefg","httpTimeout":"3","do_events":true,"do_contacts":true}}'
Method: PUT
URL: https://svc.nitrocommerce.ai/v1/rest/<your_platform_name>/integration
Data: {"org_id":<organisation_id>,"active":true/false,"type":"WEBHOOK","data":{"endpoint":"https://somewebhook.com","authToken":"abXXefg","httpTimeout":"3","do_events":true,"do_contacts":true},"id":<WEBHOOK_ID>}
Headers:
- Content-Type: application/json
- Authorization: Bearer <platform_account_user_bearer_token>
curl 'https://svc.nitrocommerce.ai/v1/rest/integration' \
-X 'PUT' \
-H 'Authorization: Bearer <platform_account_user_bearer_token>' \
-H 'Content-Type: application/json' \
--data-raw '{"org_id":<organisation_id>,"active":true/false,"type":"WEBHOOK","data":{"endpoint":"https://somewebhook.com","authToken":"abXXefg","httpTimeout":"3","do_events":true,"do_contacts":true},"id":<WEBHOOK_ID>}'