Freshdesk Api - contact ID's and populating records for custom object lookup fields

Hi,

i have a question regarding the response received after calling the endpoint for viewing a specific contact ( https://developers.freshdesk.com/api/v2/contacts/[id] ) and the usage of ID’s in lookup fields when creating a custom object record.

In the response for viewing a contact there are 3 ID’s:

  • “id”: which is the freshdesk contact ID
  • “visitor_id”: no idea what that is, any info on this?
  • “org_contact_id”: thats an interesting one. More on that below

So in the documentation ( Freshdesk ) there isn’t that much info on the fields in the json response to this API call.

The reason this came to my attention was the following. We have created a custom object, which is connected to contacts and companies via a lookup field. I then tried to populate the custom object with records via import CSV and also via POST request to https://developers.freshdesk.com /api/v2/custom_objects/schemas/schema-id/records/
There was a problem with, what information has to be added to the lookup fields so the endpoint is accepting the payload and a new record is created.

So for contacts, it was not the “name” and not the “id” but funny enough this ominous “org_contact_id”.

For company this org_contact_id field was absent from the response for “view a company”: Freshdesk , so i tried other things and what worked was the company name.

So, really, i don’t get it. Why? Why not use the freshdesk ID which is also available from the url in the contact but use some ID nobody knows about?

Would greatly appreciate some more information on this. The only thing i could find about creating a record for a lookup field on custom objects was from this article: Adding Custom Object records in Freshdesk : Freshdesk
but here it says that that “Lookup field to Contact must have the email ID” , well yet another ID which i do not know about ^^

Thanks for your help!

Bye, Ramon

Ok, i will answer it myself.

So, to populate a lookup field in a custom object record you would need to use either the org_contact_id for contacts, the “org_company_id” for companies and the display_id for tickets. For another custom object record to be connected, use the record id.

This information was added to the dev documentation on custom objects :wink:

Now, here comes the problem!

While the org_contact_id is present in the api response for the call to /api/v2/contacts/[id] , the org_company_id is missing from the GET call to /api/v2/companies/[id] .

Only if you fetch ALL companies as a list via GET /api/v2/companies you will see the org_company_id in each company element of the response.

Quite a bummer!

Bye

2 Likes

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.