API: Consistently have an "id" field for linked entities

Andreas Göb
Andreas Göb Posts: 1

When working with the Pipedrive API for integration purposes, I often navigate to other entities via some of the ..._id fields, e.g. a Deal object has fields user_id and org_id for the owner, and the linked organization, repsectively.

Currently the returned fields for User and Org in a Deal are:

"user_id": {
  "id": 424242,
  "name": "...",
  "email": "...",
  "has_pic": 1,
  "pic_hash": "...",
  "active_flag": true,
  "value": 424242
"org_id": {
  "name": "...",
  "people_count": 123,
  "owner_id": 123456,
  "address": "...",
  "active_flag": true,
  "cc_email": "...",
  "value": 32

While the user_id object contains an id as well as a value field, both with the same value, the org_id is missing an id field, and just has a value field (that contains the Organization's ID). When querying organizations via the /organizations endpoint, the id field is always set. This makes it very cumbersome to deal with organization objects, because their ID is stored in a different field, depending on how the object was obtained.

Also: Is there some proper documentation about which fields are present when retrieving an object directly via its own endpoint vs. when it comes as a sub-entity of another object? This always seems like trial-and-error to me. Especially, links to dependent objects one level deeper (like the org_id.owner_id in the example above) are not even objects with an id field anymore, but just plain numbers.

Thanks for any hints on how to deal with these inconsistencies other than building special cases for every occurrence,


1 votes

Active · Last Updated