Choose where you’d like to start

Fetch records from Zoho Subscriptions

Overview

This task is used to fetch records from Zoho Subscriptions. This task is based on Zoho Subscription API <ModuleName> -> List All <ModuleName>.

Syntax

<variable> = zoho.subscriptions.getList(<moduleName>, <organization_ID>, <per_page>, <page>, <connection>);

where:

Params Data typeDescription

<variable> 

KEY-VALUE

Response returned by Zoho Subscriptions.

<module_name> 

TEXT

The name of the module from where the records will be fetched.

<organization_ID>

TEXT

ID of the organization from where the records will be fetched.

Note: Learn how to fetch organization ID from the UI and from the response of zoho.subscription.getOrganization task.

<per_page>

NUMBER

Maximum number of records in a single page.

 

<page>

NUMBER

To get the list of records based on pages.

 

<connection>

TEXT

The link name of the Zoho Subscriptions connection.

Note:

  • In view of stopping new authtoken generation, a Zoho OAuth connection with appropriate scopes is mandatory in order for new integration tasks (created after the deadline specified in the post) to work as expected. Existing integration tasks will continue to work with or without the connections parameter until you manually delete the authtoken from accounts.
  • Add relevant scopes mentioned in Zoho Subscription API while creating the connection.
  • Refer to this post for the list of Zoho services that support the connections page.
  • Learn more about connections

Example: Fetch records from Zoho Subscriptions

When the following script gets executed, the specified record is updated in the "Subscriptions" module in Zoho Books.

response = zoho.subscriptions.getList("Subscriptions", "66XXXXX66", 1, 200, "subscriptions_connection");

where:

response
is the KEY-VALUE variable returned by Zoho Subscriptions
"Subscriptions"
is the TEXT that represents the module from which the records need to be fetched.
"66XXXXX66"
is the TEXT that represents the organization ID of the Zoho Subscription account in which the records will be fetched
1
is the NUMBER that represents the index of the first record that will be fetched
200
is the NUMBER that represents number of records that will be fetched
"subscriptions_connection"
is the TEXT that represents Zoho Subscriptions connection link name

Sample Response

The success response returned is of the following format:

{  
   "message":"success",
   "transactions":[  
      {  
         "amount":1000,
         "status":"sent",
         "reference_id":"INV-000002",
         "type":"invoice",
         "date":"2015-03-10",
         "transaction_id":"115888000000046015"
      },
      {  
         "amount":100,
         "status":"sent",
         "reference_id":"INV-000001",
         "type":"invoice",
         "date":"2015-03-10",
         "transaction_id":"115888000000047015"
      }
   ],
   "page_context":{  
      "per_page":200,
      "sort_column":"date",
      "has_more_page":false,
      "page":1,
      "applied_filter":"TransactionType.All",
      "sort_order":"D"
   },
   "code":0
}

To fetch the record IDs from the response, use the following snippet:

var = <response_variable>.get("<module_name>"); 
// example for <module_name> is customers
for each var1 in var
{
info var1.toMap().get("<module_name>_id");
// example for <module_name>_id is customer_id
}

The following is a sample failure response:

{  
   "message":"Invalid URL passed",
   "code":5
}

Related Links

Get Started Now

Execute