Custom objects handbook

Have more questions? Submit a request

21 Comments

  • Mark DiValerio

    Can Custom Objects and Relationships be retrieved via the support app client? i.e. sidebar_client.get("relationships") or sidebar_client.request("/api/custom_resources/resources/{resource_id}/relationships/{relationship_type_key}")??

     

    Thanks,
    Mark DiValerio

    0
  • Bryan Flynn

    Hi Mark. The interface to Custom Objects is only through REST APIs right now. There is a strong interest in having a tighter integration with the Apps framework, however, so keep an eye out in the future for changes such as this.

    0
  • Joseph May

    Hi there Mark-

    As Bryan pointed out, a tighter integration with the apps framework is not available right now. That said, your second example would still work with the Zendesk Apps framework - the only option currently is using client.request().

    Regards,

    Joey

    0
  • Ben Heiligenthal

    Is there a size limit for the data array for a job? I'm trying to bulk import ~4000 custom objects and I'm not sure if this can all be done in one job, or if there is a better way to bulk import custom objects other than via the API.

    0
  • Bryan Flynn

    Hi Ben. The limit is a 1000. It's not documented right now but soon will be.

    0
  • Ben Heiligenthal

    Thanks for the response Bryan. One more question, when inserting relationship records, can this be done with the external_ids of each object? Or does it have to be the ids generated from when created in zendesk?

    0
  • Bryan Flynn

    Hi Ben. It's the Zendesk generated ID of the resource.

    0
  • Ben Heiligenthal

    So there is no way to use the external_id? 

    0
  • Bryan Flynn

    Can you give more details on your use case Ben?

    ID is the attribute that is guaranteed unique across all resource types. If you give more details maybe there's some approach that can get you what you're looking for.

    0
  • Jason Martens

    Hi Ben, it sounds like you want to have external IDs in the source or target of a relationship, is that correct?

    If so, this is not something that you can do currently. The workaround is to create a relationship to an object, then get the external ID from that object. 

    0
  • Ben Heiligenthal

    Jason,

    Yes, using the external_ids in the source and target was my intent. I can do it without using them, it just would have been a nice convenience. Thank you for the response

    0
  • Ben Heiligenthal

    Deleted my previous comment. Figured out the links. Now I just have this question:

    How do I get more objects per page in a GET to get all of my objects of a certain type? What should the url look like?

    0
  • Bryan Flynn

    Is this what you're looking for Ben?

    You can specify up to 1000 records per page using the per_page parameter:

    https://developer.zendesk.com/rest_api/docs/custom-objects-api/resources#parameters

    If listing object records by object type key, you can use the following optional query string parameters:

    Name Type Comment
    per_page string Number of object records per page from 1 to 1000

    Example:

    https://{subdomain}.zendesk.com/api/custom_resources/resources?type=product&per_page=100
    0
  • Matt Owens

    Any way we could get the "next page" in web JSON view to link to the next and previous page? Perhaps also a page with the per_page parameter?

    0
  • Ben Heiligenthal

    Thank you for your help, those suggestions were what I was looking for. Now I have another question:

    When I try to delete all my object records (for testing purposes to test bulk adding them afterwards) I successfully delete all records (~4000) but one. No matter what I try I can not delete this specific record. I get the error 

    Invoke-RestMethod : The remote server returned an error: (412) Precondition Failed.

     

    I'm not sure why this is happening. Any ideas?

    0
  • Bryan Flynn

    Hi Ben. Is it that particular record or just whatever the last record is that can't be deleted? I'm thinking maybe there's a relationship with another object type that's somehow keeping that record from being deleted.

    This may also be an issue that's specific to your instance and what Custom Objects is doing behind the scenes. Please enter a ticket with support@zendesk.com and we can dig into it deeper.

    0
  • Ben Heiligenthal

    Bryan, 

    You were correct, after I deleted relationships I was able to delete all of the Object records. Thank you for all your help

    0
  • Bryan Flynn

    Great to hear! Thanks for sharing Ben.

    0
  • Matt Owens

    Hey all, 

    Wanted to see if there might be any plans to support a look-up by external_id on custom objects? 

    Use Case: We are looking to use Objects as Projects. Each project is assigned an ID internally. As project progresses, people are added and removed. Additionally we update the state of the project as well as attributes through the Lifecycle. 

    Currently we'd have to write back the Zendesk Object ID after creation into our own DB. If we could just perform a look-up on external id it would simplify updating as well as avoiding duplicate object creation. 

    Best, 

    Matt 

    0
  • Jason Littrell

    @Matt Owens: I don't see this documented anywhere, but this works for me:

    GET /api/custom_resources/resources?type={resource_type}&external_id={external_id}

    You have to declare the resource type with the external ID or the call will fail. I think it's set up that way because the custom resources API only enforces unique external IDs per resource type.

    0
  • Matt Owens

    Thank you @Jason!

    This is incredibly helpful, changes some build plans for sure!

    0

Please sign in to leave a comment.

Powered by Zendesk