CREATING A CONNECTION
First, make a call to Connection Types in order to find out about available types you can create.
Then, make an OPTIONS request against the Connection type of your choice to find out about available/mandatory options.
Example: OPTIONS for a Connection with Connection_type "123".
curl -X OPTIONS \
https://YOUR_STACK.datatap.adverity.com/api/connection-types/123/connections/ \
-H 'Authorization: Token TOKEN_VALUE' \
Result: The result will give you a list of all relevant options that you will include in your POST request body to create a connection of this type, depending on which type is chosen.
- Connection Name: "NAME". A human-readable name.
- Workspace: "STACK". The Workspace ID.
Example: POST request to create a Connection with Connection Type "123".
curl -X POST \
https://YOUR_STACK.datatap.adverity.com/api/connection-types/123/connections/ \
-H 'Authorization: Token TOKEN_VALUE' \
-H 'Content-Type: application/json' \
-d '{
"datatype": "DATATYPE",
"cron_type": "CRON_TYPE",
"name": "NAME_OF_STREAM",
"stack": WORKSPACE_ID
}'
AUTHORIZING CONNECTION
To authorize your connection:
- Create a request to Connection Types (the first section RETRIEVE ALL WHITE-LISTED CONNECTION TYPES).
- In the response of the previous request, find your Connection type ID. This ID is displayed as the value of parameter id.
Connection type ID example value: 123
- Create a request to Connection Types (the second section LIST CONNECTIONS PER TYPE).
- In the response of the previous request, find your Connection ID. This ID is displayed as the value of parameter id.
Connection ID example value: 123
- Make the following request to authorize your connection:
Example: GET request to authorize a connection:
curl -X GET \
https://YOUR_STACK/api/connection-types/CONNECTION-TYPE-ID/connections/CONNECTION_ID/authorize/ \
-H 'Authorization: Token TOKEN_VALUE' \Result:
{
"status": "ok",
"is_authorized": false,
"is_oauth": true,
"url": "https://YOUR_STACK/oauth2/token/TOKEN_VALUE"
} - From the API response, use the URL (the parameter is marked as url) to redirect you to the login page of the data provider for your connection.
- At the data provider website, use credentials and authorize your connection.
You have successfully authorized your connection through the management API.
SEARCH FOR CONNECTIONS
To search for available Connections instead of paging through all possible options, use the following SEARCH request:
curl -X SEARCH \
https://YOUR_STACK.datatap.adverity.com/api/connection-types/?search=CONNECTION_NAME \
-H 'Authorization: Token TOKEN_VALUE' \
Result (Cropped for one return)
{
"count": XYZ,
"next": null,
"previous": null,
"results": [
{
"id": CONNECTION_ID,
"name": "CONNECTION_NAME",
"slug": "CONNECTION_AUTHORIZATION",
"url": "https://YOUR_STACK.datatap.adverity.com/api/connection-types/CONNECTION_ID/",
"connections": "https://YOUR_STACK.datatap.adverity.com/api/connection-types/CONNECTION_ID/connections/"
}
]
}
EDITING A CONNECTION
To edit an existing Connection, perform a PATCH request where the elements to be changed must be contained within the body. In the below example, the name is changed to "NEW_NAME".
curl -X PATCH \
https://YOUR_STACK.datatap.adverity.com/api/connections/CONNECTION_ID/ \
-H 'Authorization: Token TOKEN_VALUE' \
-H 'Content-Type: application/json' \
-d '{"name":"NEW_NAME"}'
Comments
0 comments
Article is closed for comments.