I’m successful in using the API to create tickets.
I have a need now to add attachments with some tickets. I’ve reviewed the docs and see that it can be done with a PUT. Yet, the docs are vague after that. I’m not sure what the PUT JSON would look like because I do not see any examples.
I thought that I could create a ticket manually with an attachment and then GET it to look at the JSON. But that doesn’t provide much help.
Maybe I’m confused. Is an Article a Ticket? Or a sub-item of a Ticket? And then an Attachment has to be a part of an Article?
And, in your Articles link above… it appears the Ticket needs to be created first, and then an Article with Attachment can be added/updated to it. Is this correct?
I think this is where my confusion is coming from.
What I’m trying to accomplish is this - We are working on a Tech return process for creation of a UPS shipping label PDF (currently via CSV on UPS, future via API). The label needs to have a Ticket # in a Reference line.
Then we can to keep a copy of this PDF of the UPS shipping label in an open Ticket. We’re just looking for the most efficient method to create the Ticket, note the ticket #, put that in the UPS label creation Ref line (manual CSV process), then attach those labels back into the tickets.
I wanted to piggy back on this post because I am also having trouble attaching a PDF file to an article to update a ticket. I’m able to make tickets with the API, but what specifically do you need to pass to tell the location/file path of the pdf I want to attach?
The documentation says it’s identical to “POST”, but I’m getting confused because it still seems like I need to provide the API with more data, like a file path?
Thank you for all the help in advance! I can provide more info if needed!
Here’s the Python code I’m using (Currently throwing 500 Internal Server Error). I may not be using the Requests or File objects correctly but any help on what I’m doing incorrectly would be greatly appreciated!!
update_params = {
"title": "update Test title",
"state": "open",
"priority": "2 normal",
"article": {
"subject": f"update Test subject {update_type}",
"body": "RMS Test body",
"internal": True
}
}