This guide covers what you have to do in the process to set up the User Creation API.
- URL (will be provided to you)
- API testing app / browser add-on:
- Postman (Chrome) - https://www.postman.com/downloads/
1. Get Authorisation Token
Before any API call is made, an authorisation token must be created. To retrieve the authorisation token and code to the API call endpoint, you will need the following:
- The ClientID and ClientSecret: Commerce Vision will provide these to you
1. Open your Postman app.
2. Click the Authorization tab.
3. In Type, select OAuth2.0.
4. Go to Configure New Token.
5. In Token Name, enter a name of the token.
6. In Grant Type, select Client Credentials.
7. In Access Token URL, enter the URL (given to you).
8. Enter the Client ID and Client Secret provided to you.
9. In Client Authentication, select Send as Basic Auth header.
10. Click Get New Access Token to get the token.
The response is an object with two fields:
- Token Type: this is the authorisation type that is needed for the api calls (should be 'bearer' usually)
- Access Token: this is the actual token
11. Click Use Token.
2. Make the API call
You will need:
- The Token API endpoint: /api/token
- The API endpoint: /api/user
The Token Type and Access Token you created are needed to make the API call. The API endpoint requires use of the token type and token in the authorisation header.
1. Set the request type to POST.
2. Enter the URL (domain name) and then add /api/user
3. On the Body tab, select Raw, then JSON. The API request will return the payload in JSON.
4. Add this sample in the body.
5. Click Send.
NOTE - The response object should contain a response that allows you to see whether the call succeeded and whatever response information the call will return. All responses should contain "Success" and may contain "Message" (it should have the field but might have no content depending on the service). All other fields on the response object are endpoint specific.
If the user does not exists, a new user will be created. If you have selected for a Welcome email to be sent ("SendWelcomeEmail": true), this should have been sent.