List objects for a user

5 Comments

  • Official comment
    Ashwin Raju
    Zendesk Product Manager

    Let's say you have an object called "Device" which captures all the devices that your company owns. And you have a lookup field called "Assigned to" in the Device object, which points to a User Record. If you want to know what devices have been assigned to John Doe using APIs, you can use this Lookup field API to get the list of devices

    GET /api/v2/zen:user/{John doe's Record ID}/relationship_fields/{field_id of assigned_to field}/zen:custom_object:device

    Hope this helps 

  • Ashwin Raju
    Zendesk Product Manager

    This is a good question. Option 3 is the right approach to go with.. 

    You can build the API path in this way:

    • GET /api/v2/zen:user/{target_id}/relationship_fields/{field_id}/zen:custom_object:pokemon_captured

    However, let me respond back with a more descriptive approach to retrieve source relationships.

    0
  • Ashwin Raju
    Zendesk Product Manager

    Having said that, we also do have another internal API to retrieve the Lookup fields pointing to a specific target record type..
    In the above example: 
    Give me all the Lookup fields where the target is a User Object.. 

    Do you see that being useful in any of your use cases? If yes, we can externalize that API..

    0
  • Thomas (internalnote.com)
    Community Moderator

    Ashwin Raju 

    Thanks for the feedback, 

    (Not sure if troubleshooting can happen in this thread or if I should raise a Support ticket?)

    When I enter

    https://{{domain}}.zendesk.com/api/v2/zen:user/10992004688146/relationship_fields/0991933583506/pokemon_captured

    with 10992004688146 the ID of my user and 0991933583506 the ID of my lookup field

    I get an error 

    "error": "InvalidEndpoint",

     

    Give me all the Lookup fields where the target is a User Object.. 

    I think it might be useful for more complex setups where Custom Objects are really a part of a flow.

    • You might want to build a sidebar app that loads Devices, Service Logs and Software for a user across multiple objects and make the API generic so that if someone adds another record type (e.g. peripherals) that the Facility App will also show those since it's a Lookup Target > user object.
    •  

     

    1
  • Ashwin Raju
    Zendesk Product Manager

    Can you try

    https://{{domain}}.zendesk.com/api/v2/zen:user/10992004688146/relationship_fields/0991933583506/zen:custom_object:pokemon_captured

    0

Please sign in to leave a comment.

Powered by Zendesk