SDP Cloud Invoke URL
Table of Contents
Overview
The zoho.sdp.invokeUrl task allows you to utilize the API endpoints provided by SDP Cloud to access and modify your data.
- It can only be executed from the same SDP Cloud account whose data you need to access. Hence, authentication headers are not needed to perform the API call.
- Only SDP Cloud's API endpoints can be invoked using this task, hence the domain name can be omitted while providing the API URL.
Syntax
response = invokeUrl [ url: <url_value> type: [<type_value>] headers: [<headers_value>] content-type: [<content_type_value>] parameters: [<parameters_value>] detailed: [<detailed_value>] response-format: [<response_format_value>] response-decoding: [<encoding_format_value>] ];
Parameter | Data type | Description |
<response> | KEY-VALUE/ FILE/ TEXT/ LIST | The variable that will contain the response returned by SDP Cloud. |
<url_value>
| TEXT | The request URL as specified in SDP Cloud API. |
<type_value> (optional) | Constant | The HTTP request method. Allowed values:
Default value: GET |
<headers_value> (optional) | KEY-VALUE | The attributes or the header values. |
<content_type_value> (optional) | KEY-VALUE | The type of content that needs to be sent in the body of the HTTP request. Allowed values: Any valid content type. Eg, multipart/form-data, application/x-www-form-urlencoded, application/json, etc. Default value:
|
<parameters_value> (optional) | TEXT/FILE/ KEY-VALUE | The body of the request. Send various types of request body using invokeUrl:
|
<detailed_value> (optional) | BOOLEAN | This parameter decides if a detailed response needs to be returned. Allowed values:
Default value: false |
<response_format_value> (optional) | Constant | If this parameter is supplied with the value - FILE, the response is converted and returned as a FILE object. Allowed values: FILE |
<encoding_format_value> (optional) | TEXT | The character encoding scheme with which the response returned needs to be decoded. Allowed values: Click here to find the list of allowed values to this parameter. Default value: UTF-8 |
Example
The following example utilizes the SDP Cloud's API endpoint to add a file fetched from cloud as an attachment to the request of ID - 3173000000203001:
// Fetch a file from cloud pdf_file = invokeurl [ url: "http://www.africau.edu/images/default/sample.pdf" type: GET ]; // Create a map to hold the API parameters paramsMap = Map(); paramsMap.put("filename", pdf_file); paramsMap.put("addtoattachment", "true"); // Perform SDP invokeUrl task to upload and associate file to a request response = zoho.sdp.invokeurl [ url: "/api/v3/requests/3173000000203001/_uploads" type: POST parameters: paramsMap ]; info response;
where:
response
paramsMap
pdf_file
Response Format
Success Response
- The success response for the example provided will be returned in the following format:{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"files": [
{
"request": {
"id": "3173000000203001"
},
"size": "3028",
"content_type": "application/pdf",
"module": "Request",
"file_id": "5001",
"name": "sample.pdf",
"content_url": "/requests/3173000000203001/uploads/5001",
"id": "3173000000206001"
}
]
}
Related Links
- SDP Cloud Integration Tasks
- Connections
- To do more using SDP Cloud API, these help pages might help.
- You can find the possible error codes here.