OAuth 2.0
API access will require OAuth 2.0 authentication which in-turn will require technical user for a particular distributor in Schneider authentication system.
To request credentials please email: distributorapiportal.global@se.com
How OAuth works:
- API user need to have static client-id and secret key along with token generation endpoint from API provider.
- Using above details, Token API needs to be called with POST method.
- This API will return Bearer token, which can be used for 1 hour to call API, this can be treated as dynamic credential which has expiry of one hour.
Environment | Token generation Endpoint |
QA | https://api.qa.se.com/token |
Pre-prod | https://api.preprod.se.com/token |
Production | https://api.se.com/token |
How to generate token using Postman:
- Create New API request with actual API endpoint
- Go to Authorization section
- Select Type as OAuth 2.0
- On right side, go to Configure New Token
- Token name can be user defined (e.g., distributor name)
- Grant Type = Client Credentials (Select from drop down)
- Access Token URL will be as per above table
- Client ID and Client Secret will be given by Schneider team
- Scope all
- Client Authentication can be Send Client Credentials in body
- Click on Get New access token
Token Generation Sample using new Postman request:
- Select POST and enter the Token URL.
- From the Body tab, click on radio button x-www-form-urlencoded.
- Manually enter Key and Value, “grant_type” and “client_credentials”.
- From the Authorization tab, select Type “Basic Auth”.
- Set Username to the client key (provided to you offline).
- Set Password to the client secret (provided to you offline).
- Send request and retrieve value of access_token from the response message.
Token Generation Request Creation using CURL in Postman:
- In postman, select Import option (which is on the upper left).
- On the Import dialog, select Raw text and paste the curl sample provided below.
- Click Continue and then Import.
- From the Headers tab, replace the Authorization value with the Base-64 encoded string of client_key and client_secret.
Sample curl for Token Generation:
curl --location --request POST 'https://api.se.com/token' \
--header 'Authorization: Basic askjdfsaldalskjfdlsajflasdkjfb2h4NVJxMFlSZ2hUbA==' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials'
API-Key
For few APIs, access using API-key is also feasible where you provide the long-lived apikey as a query parameter.
Once you have an apikey, you can exercise GET operations directly in a web browser.
URL format: https://{hostname}/{BaseURL}/{ResourcePath}?{queryParams}&apikey={your_api-key}