79158667

Date: 2024-11-05 10:31:17
Score: 2
Natty:
Report link

I did receive help from Zoho.

In order to call Zoho CRM function using the OAuth method, we'd need to get an access token and pass it in the header of the request.

Here are steps of what I've done

  1. Create client in Zoho Developer's console (Self Client) with a Scope of Zoho.CRM.functions.execute

2.Call to get a refresh token:

getRefreshToken = invokeurl [ url :"https://accounts.zoho.eu/oauth/v2/token?grant_type=authorization_code&client_id=xxx&client_secret=xxx&redirect_uri=https%3A%2F%2Fcrm.zoho.eu%2F&code=xxx" type :POST ]; ref_Tok = getRefreshToken.getJSON("refresh_token");

The client ID, Secret and Code you get from the developer's console client.

  1. Get access token: Using the refresh token, client id, client secret and the grant type as parameters. This is a POST request!

https://accounts.zoho.eu/oauth/v2/token?refresh_token=xxx&client_id=xxx&client_secret=xxx&grant_type=refresh_token

  1. Call the function using this url: https://www.zohoapis.eu/crm/v2/functions/getleadsdata/actions/execute?auth_type=oauth&requested_by=xxx

This is a GET request (very important!)

The access token that we get from the previous call we pass as a header in this structure:

Authorization: Zoho-oauthtoken access_key (There is space between authtoken and the access key).

Requested_by can be passed as parameter, I did it as it's a parameter that I need to pass when calling the function.

Something else that is important to note, I was advised by Zoho that when making a call to get the Access token, that has to be done from outside Zoho for some reason, otherwise the access token doesn't work...

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-1):
  • No code block (0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Denis Denchev