phpwordpresszoho

Get document list by their request_status for example "completed" in Zoho api PHP?


I am trying to connect with Zoho CRM using php. I followed this document https://www.zoho.com/sign/api/#get-documents-list for fetching list of sign documents.

It is taking long time on processing and sending response. I am trying to filter my request so that it will return only those documents which has request_status "completed".

Also, is there any way to fetch Intern docs using same api?

My website is in wordpress and i am using this code:

function zoho_doc_call($page, $docs_array) {

  $token = get_zoho_token();

  $params = str_replace("}","%7D", str_replace("{","%7B","{%22page_context%22:{%22row_count%22:50,%22start_index%22:".$page."}}"));
  $url = "https://sign.zoho.com/api/v1/requests?data=".$params;
  $args = array(
    'headers' => array( "Authorization" => "Bearer ".$token),
  );

  $response = wp_remote_get( $url, $args );
  if ( is_array( $response ) ) {
    $response = json_decode(wp_remote_retrieve_body( $response ), true);
    //echo "<pre>"; print_r($response);die;
    $new_array = array_merge($docs_array, $response['requests']);  

  }  

  if ($response['page_context']['has_more_rows']) return zoho_doc_call($page+100, $new_array);

  return $new_array;
}

I am new to this api. Can anyone please help me to fix long waiting time issue?

Thanks!


Solution

  • I am part of the development team of ZohoSign. Yes you can fetch the documents that are in completed status using ZohoSign get documents list API (details below). In addition to the page_context data, another parameter 'request_status' with value 'completed' also needs to be passed.

    API Details

    GET https://sign.zoho.com/api/v1/requests

    Parameters :

    request_status=completed
    
    data={"page_context":{"row_count":100,"start_index":1,"search_columns":{},"sort_order":"DESC"}}
    

    Example :

    curl -G https://sign.zoho.com/api/v1/requests     -H "Authorization: Zoho-oauthtoken <Oauth-token>"    -d 'request_status=completed'    --data-urlencode 'data={"page_context":{"row_count":100,"start_index":1,"search_columns":{},"sort_order":"DESC"}}'
    

    For further queries you can reach us at support@zohosign.com