Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Excerpt
hiddentrue

Set up Salesforce User Creation API to allow a user to be created from the Salesforce a third party contact screen.


This User Creation API is called with a payload (transmitted data) of the user information from the Salesforce a third party provider's contact screen. The web application will run validations and create the user after the validations are passed. An option in the payload is to specify whether a welcome email is to be sent to the user.

...

  • The ClientID and ClientSecret (will be provided to you)
  • The Token api endpoint: /api/token
  • The api endpoint: /api/user 


Prerequisites

  1. URL (will be provided to you)
  2. Username
  3. Password 
  4. Sample Setup Request file (see sample at the end of this page)
  5. API testing app / browser add-on: 


Step-by-step guide

1. Get Authorisation Token 

Before any API call is made, an authorisation token must be created.

...

  • response.token_type: this is the authorisation type that is needed for the api calls (should be 'bearer' usually)
  • response.access_token: this is the actual token


Make the API call

The token_type and access_token are needed to make the API call. The API endpoint requires use of the token type and token in the authorisation header.

...

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.



Example

Below is an simple example of combining the above into a function that retrieves a token and caches it in local storage. It also retrieves the token if it is not cached or if the api endpoint call returns a 401 (not authorized) because the token is expires:

...