Skip to main content

I’m working on using the API to access events in order to sync certain ones to a series of Google Calendars. I have been able to generate a call that will grab the information I need from a single event. Unfortunately, I have to know the event ID in order to do that.

Does anyone know what params I need to list all event IDs?

The events module API seems to be undocumented, so it’s been difficult to discover what I need. (And, for a bonus ask… anyone know how to list tickets as well.)

Thanks for your help!

Paul

Good Morning @PMurray 328b4 pps 

I hope you are doing well so far today! 

I just wanted to reach out today to offer some assistance in pulling the Event Id for your district as well as pulling a list of tickets. The best way to achieve both of these would be to use create a custom view for the tickets/events you would like to see and then use an API call to call on that view. For the following API call provided below, you should be able to replace the {} brackets with the information in the bracket to return the results for an Event view.

curl --location 'https://{SITE}.incidentiq.com/api/v1.0/events/query' \
--header 'accept: application/json, text/plain, */*' \
--header 'accept-language: en-US,en;q=0.9' \
--header 'client: WebBrowser v1729649086432' \
--header 'content-type: application/json' \
--header 'priority: u=1, i' \
--header 'productid: 88df910c-91aa-e711-80c2-0004ffa00080' \
--header 'siteid: {SITEID}' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
--header 'Authorization: Bearer {TOKEN}' \
--data '{"FilterByProduct":true,"RequestOptions":{"Paging":{"PageSize":20,"SortField":"NumberOfAttendees","SortDirection":"Ascending"},"Filters":"{"Facet":"View","Id":"{VIEWID}"}]}}'

If your district would like an API call to return the results of a ticketing view, then you should be able to find that API call in the following documentation below! In addition this this call, there should be additional documentation in this call as well that should be able to help return a viewid for a custom view, but if you may be experiencing any trouble getting the view id, please let me know. Thanks again for reaching out, and I hope you have a great day! 

https://incidentiq.stoplight.io/docs/v1/60beda108fcd9-welcome


Thanks! Works great!
 

I stripped identifying information and used AI to generate the python code below.

 

# Set the URL and headers
url = 'https://{SITE}.incidentiq.com/api/v1.0/events/query'
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'en-US,en;q=0.9',
'client': 'WebBrowser v1729649086432',
'content-type': 'application/json',
'priority': 'u=1, i',
'productid': '88df910c-91aa-e711-80c2-0004ffa00080',
'siteid': '{SITEID}',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36',
'Authorization': 'Bearer {TOKEN}',
}

# Set the payload
data = {
"FilterByProduct": True,
"RequestOptions": {
"Paging": {
"PageSize": 20,
"SortField": "NumberOfAttendees",
"SortDirection": "Ascending"
},
"Filters": :
{
"Facet": "View",
"Id": "{VIEWID}"
}
]
}
}

 


As a follow-up…

As I stated, this helped me get access to the information, but I'm having difficulty getting pagination working properly. If I request 1000 records, I can get the results I need at this moment. However, if I request 20 records at a time, I only receive the first 20, as I am not receiving a page token.

# Get the next page token if available
next_page_token = response_data.get('NextPageToken')

I'm guessing that I am not requesting the token correctly. Your help is appreciated.

Additionally, is this documented? I am not finding it in the API docs.

Thanks,

 

Paul


Good Afternoon @PMurray 328b4 pps 

I hope you are doing well and thank you for reaching back out! 

If you would like to add paging to the API call, you will want to add PageIndex to the Paging array found in the body of the call. A pageindex of 0 should equate the first page of results while an index of 1 should indicate the next page and so on. An example of what this may look like is included below: 

"Paging":{"PageIndex":1,"PageSize":20,"SortField":"NumberOfAttendees","SortDirection":"Ascending"}

With that said though, if you may have any additional questions or concerns or if any issues are encountered though, please let us know! 

Best Regards,
Drew


Got it! Thanks for your help. My script is now paging properly.


Reply