### Sample GET Response Example for Trips Resource Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/content/example Use this structure to define a sample response for a GET request, specifying the resource and its core data. The 'name' attribute is mandatory when the example is a child of . ```xml This is the core data of our trips resource. { "trips": [ { "trip_name":"Spring Break - John Doe", "destination": "Bali", "start_time": "2023-11-13T17:30:00", "end_time": "2023-11-17T22:30:00", "no_of_days": 4 } ] } ``` -------------------------------- ### Example Version Tag Configuration Source: https://docs.catalyst.zoho.com/en/zest/help/format-xml/version-tag This example demonstrates how to configure the version tag with custom server and REST API resources. It specifies the version value and includes details for accommodations, destinations, travelers, and trips APIs. ```xml ``` -------------------------------- ### Version Element Example Source: https://docs.catalyst.zoho.com/en/zest/help/format-xml/version-tag An example demonstrating the usage of the 'version' element with custom servers and REST APIs. ```APIDOC ## Example Usage By default, the version details will be picked and will hold the and details. ```xml ``` ``` -------------------------------- ### Example File Extension Requirements Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/file-meta/extension This example outlines the requirements for file validations based on extensions, specifying the number of files and their size constraints for different file types. ```text png: 3 files each with size 500 to 1000 bytes xml: 2 files each with size 1000 to 1500 bytes ``` -------------------------------- ### Environment Configuration Examples Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/server/environment Illustrates how to specify environment details for development and sandbox environments, including their location and value. ```text environments: development, sandbox location and value of argument for development: param and dev location and value of argument for sandbox: param and sand ``` -------------------------------- ### Equality and Inequality Operators Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/condition Examples of using equality (==) and inequality (!=) operators for exact value matching. ```zest trip_name == 'London - Emily Jones' ``` ```zest trip_name != 'London - Emily Jones' ``` -------------------------------- ### Resource Definition Example Source: https://docs.catalyst.zoho.com/en/zest/help/format-xml/resource Defines an API resource named 'accommodations' with associated operations. The 'home-page' attribute is set to 'true' for the GET operation. ```xml ``` -------------------------------- ### Configure File Meta for Tourist Spots Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/file-meta/introduction This example demonstrates how to configure file meta for a property named 'tourist_spots'. It specifies size constraints for individual files, the maximum number of files, allowed extensions with their specific sizes and counts, overall size limits, and file name validation rules. ```xml ``` -------------------------------- ### Pattern Matching Operators (Like/Ends With/Contains) Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/condition Examples of using the 'Like' (~~) operator for pattern matching, including ends with, starts with, and contains. ```zest trip_id ~~ '*873' ``` ```zest trip_name ~~ 'London*' ``` ```zest trip_id ~~ '_984_' ``` -------------------------------- ### Content-Language Argument Example Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/operation/response Example of a 'Content-Language' argument with its value set to 'en-US'. ```text "Content-Language" argument: value is "en-US" ``` -------------------------------- ### Initiate File Download Source: https://docs.catalyst.zoho.com/en/tutorials/workdrivesync/nodejs/llms-full.md Prepares and initiates the download of a specified file. It displays a 'preparing to download' message to the user. This is a placeholder for the actual download logic. ```javascript async function downloadFile(fileName) { showMessage(`Preparing to download "${fileName}"...`, false); try { ``` -------------------------------- ### ZEST Info Component Example Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/info/introduction Demonstrates the structure of the 'info' component, including attributes like title, version, and limit, along with child elements for description, terms of service, contact details, and license details. ```xml { To get the trips data of a travel bureau. This API sternly follows the data usage and privacy policy, API Access Agreement, liability and indemnification. These terms of services are subject to modification and updates. } ``` -------------------------------- ### GET Trips Operation Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/introduction This snippet shows the configuration for a GET operation on the 'trips' resource, including success and error response definitions. ```APIDOC ## Sample #### Single operation Assume that you are writing the url for GET operation of trips resource with the following information. ```xml ``` Now, declare the url as follows: ```xml ``` ``` -------------------------------- ### Configure File Download Response Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/content/stream Example demonstrating how to configure a file download response with specific file details such as maximum size and type. ```text Maximum file size: 5000 File type: pdf There is no file name. ``` -------------------------------- ### GET Operation for Trips Resource Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/operation/introduction Defines a GET operation for the 'trips' resource, including authentication, optional parameters, and success/error response structures. Use this to read trip data. ```xml Here, we have given a sample error condition, authentication, parameter, success response and error response for the trips resource. <error condition="$.status == 'error'" /> <argument name="destination" location="param" required="true"> <content> <encode type="text/plain" /> <structure name="wrapper"> <property type="string" path="destinations:$.destination_name"/> </structure> </content> </argument> <response name="get_success" status="200"> <content> <encode type="application/json" /> <structure-ref name="data"/> </content> </response> <response name="invalid_token" status="401"> <content> <encode type="application/json" /> <structure name="error_body"> <property name="code" type="string" values="INVALID_TOKEN"/> <property name="message" type="string" values="You have used an invalid oauth token."/> <property name="status" type="string" values="error"/> </structure> </content> </response> <authentication type="oauth2" name="get" location="header" scopes="TravelAgency.settings.trips.READ" /> ``` -------------------------------- ### GET and POST Trips Operations Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/introduction This snippet defines the URL and operations for retrieving (GET) and creating (POST) trips. It includes request body structures, success responses, and error handling for invalid tokens. ```APIDOC ## GET /travel_bureau/v4/trips ### Description Retrieves a list of trips. ### Method GET ### Endpoint /travel_bureau/v4/trips ### Response #### Success Response (200) - **trips** (collections) - A collection of trip data. #### Response Example ```json { "trips": [ { "trip_name": "string", "trip_id": "long_string", "destination": "string", "start_time": "datetime", "end_time": "datetime", "no_of_days": "string" } ] } ``` ## POST /travel_bureau/v4/trips ### Description Creates a new trip. ### Method POST ### Endpoint /travel_bureau/v4/trips ### Request Body - **trips** (collections) - A collection of trip data to create. ### Request Example ```json { "trips": [ { "trip_name": "string", "destination": "string", "start_time": "datetime", "end_time": "datetime", "no_of_days": "string" } ] } ``` ### Response #### Success Response (201) - **code** (string) - Indicates success, typically 'SUCCESS'. - **message** (string) - Confirmation message, e.g., 'Trip Created'. - **status** (string) - Overall status, e.g., 'success'. #### Response Example ```json { "code": "SUCCESS", "message": "Trip Created", "status": "success" } ``` ### Error Handling - **401 Unauthorized** - **code**: "INVALID_TOKEN" - **message**: "You have used an invalid oauth token." - **status**: "error" ``` -------------------------------- ### Token Authentication Configuration Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/authentication-schema/token Example of how to configure token authentication within a resource, specifying token generation and introspection endpoints. ```APIDOC ## Token Authentication Schema ### Description Configures token-based authentication for a resource. ### Attributes - **name** (String) - Required - Name of the token. - **visibility** (String enum) - Optional - Visibility of the token (internal, private, public). Defaults to public. ### Child Elements - **description** - **token-url** (required) - **authentication-url** ## Token URL Configuration ### Description Defines the endpoint for generating grant tokens. ### Endpoint `https://authorization-server.com/token` ### Operation: GenerateToken #### Method POST #### Request Body - **client_id** (String) - Required - **client_secret** (String) - Required - **code** (String) - Required #### Request Example ```json { "client_id": "your_client_id", "client_secret": "your_client_secret", "code": "authorization_code" } ``` #### Success Response (200) - **token** (String) - The generated access token. - **api_domain** (String) - The domain for API calls. - **expires_in** (datetime) - The expiration time of the token. #### Response Example ```json { "token": "generated_access_token", "api_domain": "https://api.example.com", "expires_in": "2023-10-27T10:00:00Z" } ``` ## Authentication URL Configuration ### Description Defines the endpoint for authenticating tokens and user identities. ### Endpoint `https://authorization-server.com/token-info` ### Operation: IntrospectToken #### Method POST #### Request Body - **token** (String) - Required - The token to introspect. #### Request Example ```json { "token": "access_token_to_verify" } ``` #### Success Response (200) - **active** (Boolean) - Indicates if the token is active. - **scopes** (String) - The scopes associated with the token. - **client_id** (String) - The client ID associated with the token. - **expires_at** (datetime) - The expiration timestamp of the token. #### Response Example (Active Token) ```json { "active": true, "scopes": "read,write", "client_id": "your_client_id", "expires_at": "2023-10-27T10:00:00Z" } ``` #### Response Example (Expired Token) ```json { "active": false } ``` #### Error Response (401) - **code** (String) - Error code (e.g., INVALID_CLIENT). - **message** (String) - Error message. - **status** (String) - Status of the error (e.g., error). #### Response Example ```json { "code": "INVALID_CLIENT", "message": "Invalid client credentials.", "status": "error" } ``` ``` -------------------------------- ### Declare URL for GET Trips Operation Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/introduction Define a URL endpoint for a GET operation, specifying success and error responses with their respective status codes and content structures. This includes encoding the response as JSON and referencing defined structures. ```xml ``` -------------------------------- ### Define URL for GET and POST Trips Operations Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/url/introduction This snippet configures the URL for 'trips' resource, defining separate operations for GET (read) and POST (create) with their respective request and response structures, including referencing common error responses. ```xml <operation method="get" name="GET trips" category="read"> <response name="get_success" status="200"> <content> <encode type="application/json" /> <structure-ref name="data" /> </content> </response> <response-ref name="invalid_token" /> </operation> <operation method="post" name="POST trips" category="create"> <request-body name="request"> <content> <encode type="application/json" /> <structure-ref name="data" /> </content> </request-body> <response name="post_success" status="201"> <content> <encode type="application/json" /> <structure name="body"> <property name="code" type="string" values="SUCCESS"/> <property name="message" type="string" values="Trip Created"/> <property name="status" type="string" values="success"/> </structure> </content> </response> <response-ref name="invalid_token" /> </operation> ``` -------------------------------- ### Structure A: Create Success with Cases Attribute Source: https://docs.catalyst.zoho.com/en/zest/help/scoring-logic An example structure with the 'cases' attribute set to 'Success', used for creating records. ```xml ``` -------------------------------- ### Define Content-Level Error Conditions for JSON and XML Source: https://docs.catalyst.zoho.com/en/zest/help/zest-specification-file/content/error Configure specific error conditions for different content types within a response. The JSON example checks for '$.status == 'error'', while the XML example checks for '$.success == false'. ```xml ```