Generating Resources for Integration
Accounts with API access can generate resources that can be used to integrate into external applications. This guide explains how to generate a resource for your application.
Pre-requisites
- Active Accencio Account: You must have an active Accencio account to access the API. If you do not have an account, you can create one by visiting the Accencio Accounts website.
- Active Subscription: For each organization you manage (where you are the owner or an admin) or are a member of, you must have an active subscription to an API Access product. If you have not subscribed to an API Access product, you can do so by visiting the Accencio Accounts website and activate a subscription that meets your needs.
- Product Key: You must have a product key for the organization and API you want access to. You can find this key in the "Product Access" section of the organization's settings.
Configure API Request
Create a REST call to the API endpoint to retrieve the resource's output. The API endpoint is https://platform-api.accencio.com/resources/generate with the following payload:
async function getAccencioResource(){
const APIUrl = 'https://platform-api.accencio.com/resources/generate';
// You can use any preferred REST method to make the request
const request = fetch( APIUrl,
{
method: 'POST',
body: JSON.stringify( {
config: {
version: "1.0",
resources: [
{
key: 'ORG_ANALYSIS_KEY',
value: '<ANALYSIS_KEY>',
}
],
output: {
visualizer: '<VISUALIZER_TYPE>',
transformer: '<TRANSFORMER_TYPE>',
format: '<FORMAT_TYPE>',
},
}
} ),
headers: {
'Content-Type': 'application/json',
// This key will be found under your desired organization's "Product Access" section
// Replace the sample with your organization's unique product key for your user.
'x-accencio-key': '<ORG_MEMBRSHIP_PRODUCT_KEY>',
}
}
);
const response = await request.json();
}
Request Parameters
In the above code example, there are parameters that you need to replace with your own values:
| Parameter | Sample Code Var | Description |
|---|---|---|
format | FORMAT_TYPE | The type of output format you want to generate. |
resource | ORG_ANALYSIS_KEY / ANALYSIS_KEY | The id of the target analysis resource; works in conjunction with the vizualizer and format parameters. |
visualizer | VISUALIZER_TYPE | The type of visualization you want to generate. |
transformer | TRANSFORMER_TYPE | The type of transformed data you want to generate. |
Resources
The following table outlines what style of resource should be used when generating an output:
| Output Type | Visualizer | Resource Key & Description |
|---|---|---|
url | spotfire | key:"ORG_ANALYSIS_KEY" value:string - To reach a specific analysis, use the key ORG_ANALYSIS_KEY with the value set as the id associated with the Spotfire analysis you want to generate a url for. This id value should be provided for you from Accencio. |
Visualizer
The following visualizer types are available:
| Output Type | Description |
|---|---|
SPOTFIRE | The generated resource will be available for, or displayed within, a hosted Spotfire environment |
Transformer
The following transformer types are available:
| Output Type | Description |
|---|---|
IPG | The generated resource will be related to an IPG data format or set |
Format
The following output types are available:
| Output Type | Description |
|---|---|
URI | Output will be a string indicating a URL you can visit within the request session's timeframe |
Response
Success
The expected response for the API call will contain an output property. You can use this output to embed the data or visualization in your application.
{
"api": {
"version": "1.0"
},
"data": {
"errors": [],
"assets": [
{
"format": "<OUTPUT_TYPE>",
"visualizer": "<VISUALIZER_TYPE>",
"transformer": "<TRANSFORMER_TYPE>",
"result": "<OUTPUT>"
}
]
}
}
When an error occurs, either from bad input data or an operational issue, the API will return error objects within the response. The error response will contain a type, title, detail, and data property. The errors will reside in the errors property of the response.
{
"api": {
"version": "1.0"
},
"data": {
"assets": [],
"errors": [
{
"type": "ERRXXXX",
"title": "Invalid Input",
"detail": "Input data cannot be used in the format provided.",
"data": [
{
"id": "someIdValue",
"value": "theValueUsed",
"issue": "Invalid data format",
"result": "Unable to process data, unused in output."
}
]
}
]
}
}
Error
When an error occurs from a platform issue, the API will return an error response. The error response will contain a message, error, and statusCode property.
{
"message": "Cannot GET /resources/generate",
"error": "Not Found",
"statusCode": 404
}