Question

Attaching a generated PDF file via the API

  • 27 March 2024
  • 3 replies
  • 25 views

Badge

Just in time for the end of the school year, we are working on a staff device check-in process which looks like this:

  1. HR or supervisor creates an Incident IQ ticket for a staff member who is leaving the district.
  2. From that ticket, we use the Rules Engine to call a PowerAutomate webhook.
  3. The webhook calls the IIQ API, pulls the affected staff username and finds a list of checked out assets.
  4. These assets are included on a generated check-in PDF document.
  5. Here’s where we are stuck.  We want to attach the generated PDF file to the Incident IQ ticket.  However, there’s no apparent function on the API which can do that.

Is there a way we can attach a file to a ticket via the API?  Or do we just need to create the file in OneDrive or Google Drive and add a link to the file in the ticket comments?


3 replies

Userlevel 7
Badge +12

@AlexDB Thank you for submitting your question to our community! 😄

This is a great use of your resources. I am unsure of the file being attached via API; however, adding the link would be a safe bet. 

I'm tagging some of our API experts for back up on this. @curtis.bohlmeyer @mcsdwes @bclark Any thoughts? 

Userlevel 5
Badge +3

@AlexDB - I have never had the need to attach a PDF to an existing ticket. I do see the following on the “Update an existing ticket” API call (see code below).  So, it does look like it's possible just not sure how complex it would be.  If it's too complex, then you should be able to easily add a comment with a link to the file via OneDrive or SharePoint via the API.  Let me know which route you take as I’m sure at some point it will come up for me as well.  

As a side not the way we handle this situation is once someone has been flagged in our HR system as leaving the district we will then automatically create a ticket which has subtasks attached to it (Powerautomate flow is triggered on the HR database modification).  We do this part via email which PowerAutomate is sending.  Powerautomate also sends an email to the user leaving with a list of their devices that we get from the API and give them a link to schedule an appointment to bring the device back to a central location.  Once the user walks in the building and checks in via a Kiosk we notify our tech team who collect the devices and goes through the subtask on the ticket.

 

"Attachments": [

{

"Meta": {

"property1": null,

"property2": null

},

"SiteId": "string",

"FileId": "string",

"CreatedDate": "2019-08-24T14:15:22Z",

"Icon": "string",

"Name": "string",

"Description": "string",

"FileName": "string",

"MimeType": "string",

"FileType": 0,

"Size": 0,

"Url": "string",

"PdfUrl": "string",

"IsImage": true,

"MetaData": {

"AzureVideo": {

"Urls": [

"string"

]

}

}

}

],

Userlevel 5
Badge +10

Not sure about attaching a PDF but curious if that PDF is used elsewhere. If not maybe a more simple way to go would be adding a comment to the ticket with the same info as what’s in the PDF?

Reply