Trying to Connect Zoho CRM with REST and OAUTH

jdbuergerjdbuerger ✭✭
edited January 27, 2020 in Questions
I'm trying to connect Zoho CRM to the Skuid Platform. I created a client_id and secret_id inside Zoho and tried using it on a page but I'm stumped at how to actually get the data to start flowing. Of course it doesn't help that Zoho's documentation is terrible but still.

When I use the authorization URL of https://accounts.zoho.com/oauth/v2/, it seems to make the connection OK without an error but when I try to pull any data (say from the Contacts field) into a page, I either get an error or I get nothing. To access data, the URL is supposed to be https://www.zohoapis.com/crm/v2/Contacts. How does that relate to the authorization URL? I'm sure I'm missing something simple but this is definitely not part of the "without code" bit of Skuid's functionality. With Salesforce everything is plug and play but with outside API's, I can't make sense of what I'm supposed to do.

Comments

  • jdbuergerjdbuerger ✭✭
    edited October 1, 2017
    Some clarifications as this was posted 2 weeks ago and I've learned a lot playing around with this (tho still can't make anything work). I have set up an API at Zoho using their less-than-intuitive instructions at https://www.zoho.com/crm/help/api/v2/#oauth-request. Here's a snapshot of my Authorization page:
    image
    Here's what the Data Source setup looks like:
    image
    Here's the Model Setup in the Skuid Page:
    image
    When I do this ... I get an endless "Loading Model Data" when I try and reload the page or add fields from the model to the page:
    image
    I have tried various versions of things but have no way outside of the page to test the connection or repair the problem.


  • edited September 5, 2017
    JD, sorry to hear that this has been so difficult to get setup.

    From what I can see in the Zoho documentation, I don't think you can use the "Client Credentials" grant type --- their docs seem to indicate that you have to use "Authorization Code" Grant Type. I think this is the biggest problem you're running up against with Authentication to Zoho both with your REST-based and OData-based approaches.

    Fortunately, this is pretty easy to do --- I got it working pretty quickly with my own Zoho account, here's how to do it:

    In pictures: 

    AUTH PROVIDER

    image

    Parameter values:

    Provider Type: Other
    Grant Type: Authorization Code
    Authorize Endpoint URL: https://accounts.zoho.com/oauth/v2/auth<br>Token Endpoint URL: https://accounts.zoho.com/oauth/v2/token<br>Default Scopes: ZohoCRM.users.ALL,ZohoCRM.modules.ALL ---- NOTE: these scopes can be changed depending on what data in Zoho you want to be able to access from Skuid Platform. See the "Available Scopes" section here: https://www.zoho.com/crm/help/api/v2/#OAuth2_0 .
    Client Id: <Your Client Id that Zoho provided>
    Client Secret: <Your Client Secret that Zoho provided>
    Common Request Headers > Request Headers --- NOTE: You will need to click the arrow to expand this section. For most OAuth / REST Data Sources, this never needs to be changed, but Zoho uses a non-standard syntax here, so what you have to do is to replace where it says "Bearer" with "Zoho-oauthtoken", so that you have "Authorization" as the Header Name and "Zoho-oauthtoken {{$Auth.Response.Body.acces_token}}" as the Header Value that you want to send as a Header with every normal request to the Data Source.




    DATA SOURCE

    In pictures:

    image

    Data Source Type: REST
    URL / Endpoint: 
    https://www.zohoapis.com/crm/v2
    Is Active: checked
    Use Proxy: checked 
    Authentication Method: Authentication Provider
    Authentication Provider: ZohoCRM




    Read-only REST MODEL (in a Skuid Page)

    In Pictures:

    image

    Data Source URL: /Leads (or whatever Module you care about), e.g. /Accounts ...
    Path to Contents: data --- select the field picker to change this. NOTE: The first time you select the Field Picker, a popup window should open in your browser. You need to click to open this popup window and say "Always allow popups from <the Zoho Domain>" A popup will appear asking you to authorize your OAuth client to access Zoho with Full data access, or whatever scopes you have configured --- click to approve. Once the OAuth popup dance is completed, you should be presented with a dialog allowing you to select the "Path to Contents". Click the radio button next to "data".

    image

    Then, go click on "Fields" under your Model.

    After a second or two, you should be presented with a list of fields to choose from, e.g. the following:

    You can select the fields and then drag them into a Field Editor / Table, etc.


    image




    Click Save and Preview!
    image


    Next steps:

    - There are more advanced things you can do with REST Models, such as Create, Update, Delete, Search, Filtering, etc. These take a bit more configuration but we could follow-up with a sample page XML.
    - Alternatively, you could use an OData library to expose Zoho as OData, as you mentioned doing in another Community post.









  • jdbuergerjdbuerger ✭✭
    edited October 1, 2017
    Thank you. I got it to connect without issues tho I wouldn't have been able to come up with that without your tutorial. 

    This works well and is, in many ways, preferable to going the OData route so I'd like to pursue it further. A sample page of XML for Create, Update, Delete, etc. would be awesome. I want to see how far I can take the REST approach.
  • edited September 7, 2017
    JD, I put together a sample page that gives you read/write access to Zoho Leads, Accounts, and Contacts.

    I added the sample page to our Sample Pages repository, here is a link to the XML. Click on "Raw" to get the XML (or just click here to get the raw XML)

    https://github.com/skuid/SamplePages/blob/master/pages/ZohoCRM.xml

    See the Readme about how to use the sample page XML within Skuid:

    https://github.com/skuid/SamplePages#sample-pages
    image
    image
    image
  • jdbuergerjdbuerger ✭✭
    edited January 27, 2020
    Hi All. I'm back after some time off for other projects. I can get this to work with REST BUT when I run a call, I only get 200 records. I'm not used to this layout in Skuid as it is much harder for me to manage relative to what I learned back in my SalesForce days and working in OData. A couple of quick questions:

    1) With REST methods, how do I get above the 200 record limit?
    2) Is there a way to access Zoho Data API using OData and not REST?
  • jdbuergerjdbuerger ✭✭
    edited September 28, 2018
    I'll also add a third question:

    3) Is there a good resource to help me use REST API in Skuid? Not sure how to write the calls when I want to filter requests.
  • edited January 27, 2020
    HI jdbuerger,

    Did you get a chance to find how to integrate Odata with Zoho CRM ? 
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!