Sage 200 Authenticate an Element

You can authenticate with Sage to create your own instance of the Sage 200 element through the UI or through APIs. Once authenticated, you can use the element instance to access the different functionality offered by the Sage 200 platform.

Authenticate Through the UI

Use the UI to authenticate with Sage 200 and create an element instance. Because you authenticate with Sage 200 via OAuth 2.0, all you need to do is add a name for the instance and provide the account information you identified during API Provider Setup. After you create the instance, you'll log in to Sage 200 to authorize Cloud Elements to access your account. For more information about authenticating an element instance, see Authenticate an Element Instance (UI)

After successfully authenticating, we give you several options for next steps. Make requests using the API docs associated with the instance, map the instance to a virtual data resource, or use it in a formula template.

Authenticate Through API

Use the /instances endpoint to authenticate with Sage 200 and create an element instance. If you are configuring events, see the Events section.

Note: The endpoint returns an element token upon successful completion. Retain the token for all subsequent requests involving this element instance.

To create an element instance:

  1. Construct a JSON body as shown below (see Parameters):

    {
      "configuration": {
        "oauth.api.secret": "<API_SECRET>",
        "oauth.api.key": "<API_KEY>",
        "subscription.key": "<SUBSCRIPTION_KEY>",
        "signing.key": "<SIGNING.KEY>",
        "company.name": "Cloud-Elements Demodata"
      },
      "name": "Sage 200 Working Instance Payload",
      "providerData": {
        "code": "<INSERT_CODE>",
        "secret": "<INSERT_SECRET>"
      },
      "element": {
        "key": "sage200"
      }
    }
  2. Call the following, including the JSON body you constructed in the previous step:

    POST /instances
    
    Note: Make sure that you include the User and Organization keys in the header. For more information, see Authorization Headers, Organization Secret, and User Secret.
  3. Locate the token and id in the response and save them for all future requests using the element instance.

Example cURL

curl -X POST  https://api.cloud-elements.com/elements/api-v2/instances \
 -H 'Authorization: User <INSERT>, Organization <INSERT>'  \
 -H 'Content-Type: application/json'  \
 --data '{ \
  "name": "My Instance", \
  "providerData": { \
    "code": "" \
  }, \
  "configuration": { \
    "oauth.api.secret": "<INSERT>", \
    "oauth.api.key": "<INSERT>", \
    "subscription.key": "<INSERT>", \
    "signing.key": "<INSERT>", \
    "company.name": "<INSERT>" \
  } \
}'

Parameters

API parameters not shown in Cloud Elements are in code formatting.

ParameterDescriptionData Type
Key
key
The element key. The Sage 200 key is sage200
string
Name
name
The name for the element instance created during authentication.string
Subscription key
subscription.key
The subscription key for your account. This is one of the credentials you noted during Sage 200 API Provider Setup.
Signing key
signing.key
The signing key for your account. This is one of the credentials you noted during Sage 200 API Provider Setup.
string
Company name
company.name
The name of the company as used in the Sage 200 system.string
oauth.api.key
The API key from Sage 200. You receive an API key from Sage after you register your application with Sage.string
oauth.api.secret
The API secret from Sage 200. You receive an API key from Sage after you register your application with Sage.

Filter null values from the response
filter.response.nulls
Optional. Determines if null values in the response JSON should be filtered from the response. Yes or true indicates that Cloud Elements will filter null values.
Default: true.
boolean
tagsOptional. User-defined tags to further identify the instance.string

Example Response

{
  "id": 427164,
  "name": "My Instance",
  "createdDate": "2019-03-01T18:00:26Z",
  "token": "<<token value>>",
  "element": {
    "id": 987,
    "name": "Sage 200",
    "key": "sage200",
    "description": "Add a Sage 200 Instance to connect your existing Sage 200 account to the Finance Hub, allowing you to manage orders, payments, and more across multiple Finance elements. You will need your Sage 200 account information and a registered application to add an instance.",
    "image": "elements/provider_sage200.png",
    "active": true,
    "deleted": false,
    "typeOauth": true,
    "resources":[],
    "transformationsEnabled": true,
    "bulkDownloadEnabled": true,
    "bulkUploadEnabled": false,
    "cloneable": true,
    "extendable": true,
    "beta": false,
    "authentication": {
      "type": "oauth2"
    },
    "extended": false,
    "hub": "finance",
    "protocolType": "http",
    "parameters": [],
    "private": false
  },
  "elementId": 987,
  "provisionInteractions": [],
  "valid": true,
  "disabled": false,
  "maxCacheSize": 0,
  "cacheTimeToLive": 0,
  "configuration": {
    "oauth.api.secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "oauth.api.key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "subscription.key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "signing.key": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "company.name": "Cloud-Elements Demodata",
  },
  "eventsEnabled": false,
  "traceLoggingEnabled": false,
  "cachingEnabled": false,
  "externalAuthentication": "none",
  "user": {
    "id": 123456
  }
}