All URIs are relative to https://secure.ultracart.com/rest/v2
| Method | HTTP request | Description |
|---|---|---|
| oauthAccessToken | POST /oauth/token | Exchange authorization code for access token. |
| oauthDeviceAuthorize | POST /oauth/device/authorize | Initiate a device authorization flow. |
| oauthMe | GET /oauth/me | Identify the merchant account this access token belongs to. |
| oauthRevoke | POST /oauth/revoke | Revoke this OAuth application. |
OauthTokenResponse oauthAccessToken(client_id, grant_type, opts)
Exchange authorization code for access token.
The final leg in the OAuth process which exchanges the specified access token for the access code needed to make API calls.
var ucApi = require('ultra_cart_rest_api_v2');
const { apiClient } = require('../api.js'); // https://github.com/UltraCart/sdk_samples/blob/master/javascript/api.js
let apiInstance = new ucApi.OauthApi(apiClient);
// This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
// As such, this might not be the best way to use this object.
// Please see https://github.com/UltraCart/sdk_samples for working examples.
let client_id = "client_id_example"; // String | The OAuth application client_id.
let grant_type = "grant_type_example"; // String | Type of grant
let opts = {
'code': "code_example", // String | Authorization code received back from the browser redirect
'redirect_uri': "redirect_uri_example", // String | The URI that you redirect the browser to start the authorization process
'refresh_token': "refresh_token_example", // String | The refresh token received during the original grant_type=authorization_code that can be used to return a new access token
'device_code': "device_code_example" // String | The device code received from /oauth/device/authorize
};
apiInstance.oauthAccessToken(client_id, grant_type, opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| client_id | String | The OAuth application client_id. | |
| grant_type | String | Type of grant | |
| code | String | Authorization code received back from the browser redirect | [optional] |
| redirect_uri | String | The URI that you redirect the browser to start the authorization process | [optional] |
| refresh_token | String | The refresh token received during the original grant_type=authorization_code that can be used to return a new access token | [optional] |
| device_code | String | The device code received from /oauth/device/authorize | [optional] |
ultraCartBrowserApiKey, ultraCartOauth, ultraCartSimpleApiKey
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
OauthDeviceAuthorizationResponse oauthDeviceAuthorize(client_id, scope)
Initiate a device authorization flow.
Initiates the device authorization flow by returning a device code and user code. The device displays the user code to the merchant, who visits the verification URI to approve the request. RFC 8628.
var ucApi = require('ultra_cart_rest_api_v2');
const { apiClient } = require('../api.js'); // https://github.com/UltraCart/sdk_samples/blob/master/javascript/api.js
let apiInstance = new ucApi.OauthApi(apiClient);
// This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
// As such, this might not be the best way to use this object.
// Please see https://github.com/UltraCart/sdk_samples for working examples.
let client_id = "client_id_example"; // String | The OAuth application client_id.
let scope = "scope_example"; // String | The application-level scope (e.g., crm, ultraship).
apiInstance.oauthDeviceAuthorize(client_id, scope, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| client_id | String | The OAuth application client_id. | |
| scope | String | The application-level scope (e.g., crm, ultraship). |
OauthDeviceAuthorizationResponse
ultraCartBrowserApiKey, ultraCartOauth, ultraCartSimpleApiKey
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
oauthMe()
Identify the merchant account this access token belongs to.
Returns the UltraCart merchant account that authorized your application, along with the permissions that were granted. Call it immediately after exchanging your authorization code so you can display the connected account to your user and map it within your own system. Any OAuth access token may call this endpoint regardless of the permissions it holds. The granted permissions are the ones the merchant approved, which may be narrower than the permissions your application currently requests, because permissions are recorded when the merchant authorizes and do not change afterwards. If you add a permission to your application, already connected merchants keep the permissions they originally approved until they authorize again, so read this list rather than assuming your application's configured permissions.
var ucApi = require('ultra_cart_rest_api_v2');
const { apiClient } = require('../api.js'); // https://github.com/UltraCart/sdk_samples/blob/master/javascript/api.js
let apiInstance = new ucApi.OauthApi(apiClient);
// This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
// As such, this might not be the best way to use this object.
// Please see https://github.com/UltraCart/sdk_samples for working examples.
apiInstance.oauthMe((error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully.');
}
});This endpoint does not need any parameter.
null (empty response body)
- Content-Type: Not defined
- Accept: application/json
OauthRevokeSuccessResponse oauthRevoke(client_id, token)
Revoke this OAuth application.
Revokes the OAuth application associated with the specified client_id and token.
var ucApi = require('ultra_cart_rest_api_v2');
const { apiClient } = require('../api.js'); // https://github.com/UltraCart/sdk_samples/blob/master/javascript/api.js
let apiInstance = new ucApi.OauthApi(apiClient);
// This example is based on our samples_sdk project, but still contains auto-generated content from our sdk generators.
// As such, this might not be the best way to use this object.
// Please see https://github.com/UltraCart/sdk_samples for working examples.
let client_id = "client_id_example"; // String | The OAuth application client_id.
let token = "token_example"; // String | The OAuth access token that is to be revoked..
apiInstance.oauthRevoke(client_id, token, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});| Name | Type | Description | Notes |
|---|---|---|---|
| client_id | String | The OAuth application client_id. | |
| token | String | The OAuth access token that is to be revoked.. |
ultraCartBrowserApiKey, ultraCartOauth, ultraCartSimpleApiKey
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json