I believe you’ll need to do a POST to retrieve all tickets, and depending on how big your district is/number of tickets you have to date, you’ll likely need to account for paging as well.
You can parse the response(s) to extract the ticket ID’s.
@jclark Thank you so much for the response!
Is there any documentation on how I could do the POST? (I’m using python) I’ve been trying for a while, but was not able to make it work.
Also, could you provide some guidance on how to use pagination? I’ve been trying on this also, but was not able to figure it out.
Thanks again!
I don’t think you need a payload for this one, just change your method from GET to POST
Endpoint would be .../api/v1.0/tickets
The documentation is quite lacking, unfortunately.
@PSon 843ede9 miprepschool Thank you for submitting your question to our community! 😄
@jclark Our dev team is still working on our API documentation. While we have rehoused it, it is still a work in progress! Thank you for your continued feedback and knowledge!
@jclark @Kathryn Carter Thanks to both on your responses!
@jclark I’m doing something like the python code below, and it works for one ticket (queried with the ticket ID using “get”), and I took out the ticket ID at the end of the URL and changed “get” to “post” and it is not working. I get a “500 Server Error: Internal Server Error” response status.
headers = {
"Client": "WebBrowser",
"Accept": "application/json, text/plain, */*",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36",
"Pragma": "no-cache",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/json",
"Authorization" : {bearerToken}
}
url = "{our_url}/api/v1.0/tickets/"
response = requests.post(url, headers=headers)
Do you have any tips/advice that I could try? Thanks again!
My mistake, you do need a payload.
{
"ProductId": {ProductId},
"Schema": "All"
}
You can get your ProductId from the Developer Tools section in iiQ
@jclark I did something in the lines of the code below and it worked! Thank you so much! You’re awesome!
url = "{our_url}/api/v1.0/tickets"
payload = {
"ProductId": {product_id},
"Schema": "All"
};
response = requests.post(url, json=payload, headers=headers)
Loved watching this collaboration on this thread! Great work here team! 😄
This doesn’t seem to work anymore… The documentation is still lacking, and the Postman Template they offer doesn’t work either… Does anyone definitively know how to get a list of tickets from the API?
@BLevien 3901dca seaburyhall Our Support Team is going to be our best for API questions @athaxton_iiQ @jmaynard_iiQ @JJones_iiQ
@BLevien 3901dca seaburyhall Hey I hope you are doing well so far today!
If you would like to return all assets for your district then you would want to use a similar call to the one below. Please note that some of the information such as the bearer token will be specific to your site so I removed this info and replaced it with what you will need in Bold. Additionally, this URL contains parameters to look at the first 50 items on the first page but you can change the number of items by adusting the S value and the page by adjusting the p value in the URL. If you may encounter any issues though, please let me know!
import requests
import json
url = "https://SITE.incidentiq.com/pub/iq-modules-assets-search/v1/assets/?$s=50&$p=0&$o=AssetTag%20ASC"
payload = json.dumps({
"OnlyShowDeleted": False,
"Filters": [
{
"Facet": "ParentAsset",
"Id": None
}
],
"FilterByViewPermission": True
})
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9',
'authorization': 'Bearer TOKEN',
'client': 'WebBrowser v1758200732379',
'content-type': 'application/json',
'priority': 'u=1, i',
'productid': '88df910c-91aa-e711-80c2-0004ffa00010',
'siteid': 'SITEID',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)