Skip to main content

Request

Invokes internal or external API calls directly from the widget, enabling system integrations.

Commonly used for :
  • Calling third-party APIs securely
  • Syncing external system data
  • Validating information through remote services
  • Sending data to integrated platforms
  • Handling authenticated API communication
Connections :

When interacting with third-party services that require authentication, the request method works in conjunction with Connections to securely manage access tokens and credentials.

Why use Connections with Request :

Connections provide a secure and reusable way to authenticate and communicate with third-party services. Instead of handling tokens or credentials manually inside the widget, connections allow authentication to be configured once and reused across requests.

Using connections helps to :
  • Avoid exposing sensitive credentials in widget code
  • Manage authentication centrally at the organization or user level
  • Automatically handle token generation and refresh
  • Ensure consistent and secure API access across widgets and scripts
When to use Connections :

Connections are commonly used with the request method when:

  • Calling third-party APIs that require OAuth or authenticated access
  • Integrating external services such as e-sign providers, messaging tools, or accounting platforms
  • Making API calls that should respect organization-level or user-level credentials
Sample Code :
REQUEST DETAILS
window.onload = function () {
  ZFAPPS.extension.init().then(function(App) {
   var options = {
  url: 'https://desk.zoho.com/api/v1/tickets/',
  method: 'GET/PUT/POST/DELETE' ,
  url_query: [{
    key: 'QUERY_NAME',
    value: 'QUERY_VALUE'
  }],
  header:[{
    key: 'header-key',
    value: 'header-value'
  }],
  body: {
    mode: 'urlencoded/formdata/raw',
    urlencoded: [{
      key: 'KEYNAME',
      value: 'VALUE',
      type: 'encodedType'
    }],
    formdata: [{
      key: 'KEYNAME',
      value: 'VALUE'
    }],
    raw: 'RAWDATA'
  },
  connection_link_name: 'zohodeskconnection'
};


ZFAPPS.request(options).then(function(value) {
  //response Handling
  let responseJSON =JSON.parse(value.data.body);
}).catch(function(err) {
  //error Handling
});
})
}
KeyTypeDescription
urlStringThe endpoint URL for the API request.
methodStringThe HTTP method to use (GET, POST, PUT, DELETE).
url_queryArrayOptional query parameters to append to the URL.
headerArrayOptional headers to include in the request.
bodyObject

Optional body content for POST or PUT requests.

KeyTypeDescription
modeStringThe format of the body content (urlencoded, formdata, raw).
urlencodedArrayKey-value pairs for urlencoded body content.
formdataArrayKey-value pairs for form-data body content.
rawStringRaw string data for the request body.
connection_link_nameStringThe name of the connection to use for authenticated requests.