Choose where you’d like to start

SDP Cloud Invoke URL

Note: This task can be executed only in SDP Cloud.

Overview

The zoho.sdp.invokeUrl task allows you to utilize the API endpoints provided by SDP Cloud to access and modify your data.

Note: This task works the same as invokeUrl task (an HTTP client), except: 
  • 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>] 
];
ParameterData typeDescription

<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:

  • GET
  • POST
  • PUT
  • PATCH
  • DELETE

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:

  • application/x-www-form-urlencoded, if the body is KEY-VALUE.
  • text/plain, if the body is TEXT.

<parameters_value>

(optional)

TEXT/FILE/ KEY-VALUE

The body of the request.

Send various types of request body using invokeUrl:

  • Raw:
    TEXT data to this parameter will be sent as raw type.
     
  • x-www-form-urlencoded:
    KEY-VALUE data to this parameter will be sent as x-www-form-urlencoded type.
     
  • Form-data:
    KEY-VALUE data to this parameter will be sent as multipart form-data type, if the value of the content-type parameter is specified as multipart/form-data.

    Note:
    • If the value of the content-type parameter is not specified as multipart/form-data, the KEY-VALUE data is treated as x-www-form-urlencoded type.
  • Binary:
    FILE data is sent as binary type.

    Note:
    • The value of the <content-type> parameter must be specified as application/octet-stream, to recognize that the body is sent as binary type.

<detailed_value>

(optional)

BOOLEAN

This parameter decides if a detailed response needs to be returned.

Allowed values: 

  • true - returns response code (HTTP status code), header response, and response content as KEY-VALUE.
  • false - returns the response content.

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
The KEY-VALUE response returned by SDP Cloud.
paramsMap
The KEY-VALUE variable that holds the parameters required by the API.
pdf_file
The FILE variable that holds the file that needs to be added as attachment.

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

Get Started Now

Execute