Testing Custom REST Connector using Postman request tool
- Download Postman .
- Know your data source URL requests and HTTP Authorization header requirements.
- Generate configuration JSON file defines your connection and how the data returned is presented in the ElastiCube Manager (link).
Example New York Times Developer Network:
- Go To http://developer.nytimes.com/ and chose "Article Search"
- Article Search requests use the following URI structure: "https://api.nytimes.com/svc/search/v2/articlesearch.json"
- Copy paste request URI structure to the Postman URL Input field and test it by clicking send.
- You will get code status and relevant output, In NY Times sample. we can run requests only with using API Key.
- Adding NYT API Key to the header.
HTTP Status Code:
|
HTTP Code & Description |
1 |
200 OK, shows success. |
2 |
201 CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header. |
3 |
204 NO CONTENT, when response body is empty for example, a DELETE request. |
4 |
304 NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests. Response body should be empty. Headers should have date, location etc. |
5 |
400 BAD REQUEST, states that invalid input is provided e.g. validation error, missing data. |
6 |
401 UNAUTHORIZED, states that user is using invalid or wrong authentication token. |
7 |
403 FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights. |
8 |
404 NOT FOUND, states that method is not available. |
9 |
409 CONFLICT, states conflict situation while executing the method for example, adding duplicate entry. |
10 |
500 INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method. |
- Now we ready to generating custom REST connector at Sisense.
Configuration JSON file
{ "Settings" : {
"Provider" : "rest.nytimes.connector" ,
"DisplayName" : "NYTimes" ,
"MaxDocs" : 100 ,
"FetchSize" : 1000 ,
"IsAccumulativeSupported" : true ,
"Parameters" : {
}
},
"Tables" : [
{
"Name" : "Articles" ,
"Public" : "True" ,
"Schema" : "Https" ,
"Method" : "GET" ,
"Path" : "svc/search/v2/articlesearch.json" ,
"Headers" : {},
"AccumulativeSettings" : {
"DefaultValue" : "20160810" ,
"DateTimeFormat" : "yyyyMMdd"
},
"PathParameters" : [],
"QueryParameters" : {
"api-key" : "<XXXXXXXXXXXXXXXXXXXXXXXXXXX>" ,
"begin_date" : "[@accumulative]" ,
"sort" : "oldest"
},
"Transformation" : {
"TransformTypes" : [
{
"Name" : "pub_date" ,
"Type" : "DateTime"
}
]
},
"Body" : {},
"DataFormat" : "Json" ,
"DataPath" : "response.docs"
}
]
} |
- Following the Instruction the new custom REST connector will be optional at the Web Services in the ElastiCube Manager.
- We will be able to Import the data that we got in the Postman results to the ElastiCube.
References:
https://www.getpostman.com/docs/requests
https://community.canvaslms.com/groups/canvas-developers/blog/2016/09/11/api-testing-postman
http://developer.nytimes.com/article_search_v2.json#/Documentation/GET/articlesearch.json
Please sign in to leave a comment.
Comments
0 comments