@MWinger 113772a sbunified Thank you for submitting your question to our community!
I am tagging some of our API experts on this thread to see what their expertise can provide while I reach out to our support API specialist.
@curtis.bohlmeyer @bclark @TAnders @jclark @MattHenry Any thoughts here?
newTicket=$(curl -s --location 'YOURINSTANCE.incidentiq.com/api/v1.0/tickets/new' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' \
--header 'client: WebBrowser' \
--header 'content-type: application/json' \
--header 'accept: application/json, text/plain, */*' \
--header 'Authorization: Bearer '$iiqToken'' \
--data '{
"ForId": "'$clientUserId'",
"OwnerId": "'$agentUserId'",
"LocationId": "'$clientLocationId'",
"IssueId": "'$issueID'",
"AssignedToTeamId": "'$teamId'",
"AssignedToUserId": "'$agentUserId'",
"IssueDescription": "'"$clientName"' ticket description here.",
"Assets": [
{
"AssetId": "'$assetId'",
}
],
"Tags": [
{
"TagId": "'$tagID'",
"Name": "'$tagName'"
}
],}')
This is a command I use. The $s are variables for those items that are needed. Not every category is required (for example you can skip the tag if you don’t need it). I’m sure it could be better if Drew from IQ or someone chimes in but for now this is working for me.
Thanks @bclark, this is helpful! Do you know if it’s possible to use the submitter’s email instead of clientUserId?
I don’t know. I’ve also admittedly never looked. What I do is this call where I am searching the user by their School Id number and the resulting Json I get back I parse for the UserId which gives you that unique UUID.
I use the same call for my Agent if I’m wanting to assign it to a specific person (typically it’s the Agent running the script) as the agentUserId is really the same thing. My scripts are all in bash (just starting to dabble in Python). The last line is parsing with jq for the UserId.
clientUserInfo=$(curl -s --location 'YOURINSTANCE.incidentiq.com/api/v1.0/users/search/'$schoolId'' \
--header 'accept: application/json, text/plain, */*' \
--header 'Authorization: Bearer '$iiqToken'' \
--header 'SiteId: '$siteId'' \
--header 'accept-language: en-US,en;q=0.9' )
clientUserId=$(echo $clientUserInfo | jq -r .Items ].UserId)
Thanks @bclark, this is helpful! Do you know if it’s possible to use the submitter’s email instead of clientUserId?
Jumping in a bit late here, but you can use this endpoint to search for a user by email, extract their userId from the response, and pass it through to the next API call for ticket creation.
var data = JSON.stringify({
"Query": "joe.schmo@schooldistrict.com",
"Facets": 4,
"IncludeMatchedItem": false
});
var url = "https://{yoursite}.incidentiq.com/api/v1.0/search/v2";
var options = {
method: 'POST',
headers: {
"SiteId": {your site ID},
"Authorization": "Bearer "+{your API key},
"Pragma": "no-cache",
"Accept": "application/json, text/plain, */*",
"Client": "WebBrowser",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/json",
},
payload: data,
redirect: 'follow',
muteHttpExceptions: true
};
Thanks @bclark and @jclark. I tested the other endpoint https://site.incidentiq.com/api/v1.0/tickets/simple/new and it allows the email to be used with the ForUserName parameter and will make that email/user the submitter.
@MWinger 113772a sbunified I think you just simplified a process for me with that info lol. Good to know!
I feel like I looked at that /simple/new endpoint before and it didn’t let me do something I wanted. But that was long enough ago I don’t even remember what it was. May be worth me revisiting it. Thanks.
Love all this collaboration!!! Thank you, everyone, for your assistance on this!
Good Afternoon everyone,
I hope you are all doing well!
To create a ticket in Incident IQ using API, you should be able to do so using the simplified API call below. Please note that some information may be contained in {} brackets which will need to be replaced with the specific unique identifiers for your district. Additionally, the IssueCategoryId, IssueId, and IssueTypeId values were taken from Global values that should be present for each district, but if you would like to submit the ticket for iPad, Google Apps, WiFi, Account / Login Issue, or Other Issue Categories then these values will need to be updated to the specific unique identifiers for your district.
curl --location 'https://{SITE}.incidentiq.com/services/tickets/new' \
--header 'content-type: application/json' \
--header 'Authorization: Bearer {REMOVED}' \
--header 'accept: application/json, text/plain, */*' \
--header 'siteid: {SITE ID}' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36' \
--data '{
"IssueDescription": "Test Ticket Creation Endpoint",
"IssueCategoryId":"951a440d-bf32-e811-80c2-0003ff685988",
"IssueId":"6c1c5653-7e78-e611-80f1-000c29ab80b0",
"IssueTypeId":"10000000-0000-0000-0000-000000000001",
"LocationId": "{LOCATIONID}",
"OwnerId": "{USERID}"
}'
Best regards,
Drew