AnsweredAssumed Answered

How do I find Incidents by Requester via API?

Question asked by Thomas DiCiaccio on Sep 16, 2016
Latest reply on Sep 22, 2016 by Thomas DiCiaccio

I'm trying to use the API to pull a list of incidents created by a particular user.  Typically I format the HTTP request to get the result I want instead of parsing through the 11,000 or so tickets we have in our system.

 

When I try to pull a list of incidents I use a GET request from the following URL:

https://api.samanage.com/incidents.json?&requested_by[]=[user_id_number]

 

This did not work as intended and produced zero results.  I looked into the Requester object in the .xml file for a test Incident and found that there are two different ID numbers assigned as shown below:

<requester>

     <id>1260128</id>

     <account_id>[Account ID]</account_id>

    <user_id>1486400</user_id>

     <email>User@company.com</email>

     <name>User Name</name>

     <disabled>false</disabled>

     <has_gravatar>false</has_gravatar>

     <customer_satisfaction_survey_time nil="true"/>

 

When plugging  <id>1260128</id> into user_id_number in the original URL, I get the intended result.

 

The problem arises, however, that I cannot find that ID number anywhere else.  In the user .xml object, there is the following information:

<user>

     <id>1486400</id>

     <name>User Name</name>

     <disabled>false</disabled>

     <title nil="true"/>

     <email>user@company.com</email>

     <created_at>2016-02-22T14:45:14-05:00</created_at>

     <last_login nil="true"/>

     <phone nil="true"/>

     <mobile_phone nil="true"/>

     <department nil="true"/>

 

Is there a smarter way to pull a list of incidents via API by a requester without parsing through them all?  Or alternatively, is there a way to find the <id>Requester ID<id> field?

Outcomes