Fetch records

Fetch records from Zoho Subscriptions

Overview

This task is used to fetch records from Zoho Subscriptions.

Syntax

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

where:

Params Data typeDescription

<variable> 

KEY-VALUE

is the response returned by Zoho Subscriptions.

<module_name> 

TEXT

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

Following are the applicable modules.

Subscriptions

    Events

      Customers

ProductsTransactions    Hosted Pages

<organization_ID>

TEXT

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

(optional)

NUMBER

Maximum number of records in a single page.

Default Value: 200

<page>

(optional)

NUMBER

To get the list of records based on pages.

Default Value: 1

<connection>*

(optional)

TEXT

specifies the name of the Zoho Subscriptions connection.

*Note: This param is not applicable in Zoho Creator.

Example: Fetch records from Zoho Subscriptions

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

resp = zoho.subscriptions.getList("Subscriptions", "10982991");

where,

ParamExplanation
respis response returned as map by Zoho Subscriptions.

10982991

is the org id of the account from which the records will be fetched.

"Subscriptions"is the module in Zoho Subscriptions, from which the records will be updated.

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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com