cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

400 "ENTITY_NOT_FOUND" error when attempting to upload attachment via Web Help Desk API

I am developing a PowerShell module to interact with the Web Help Desk API in order to facilitate integration with various systems. One of the requirements is that I need to be able to add an attachment to tickets. A sample of the proof of concept script I have is here (with sensitive data substituted for dummy values).

When I run the script, I get a 400 error and the following message:

 

{"cause":"ENTITY_NOT_FOUND","reason":"ENTITY_NOT_FOUND"}

 

I have also tried using Postman, and I get the same result.

Please note that the entityId in the querystring is a valid ticket number in our system, and I was able to successfully upload an attachment to that ticket through the UI with the user that the API key I'm using belongs to, so it shouldn't be a permissions issue.

We are currently have version 12.7.1 of Web Help Desk.

Labels (2)
0 Kudos
2 Replies
Level 7

Hello @bradley_mmi

There is a bug in the REST API for WHD 12.7.1 (and 12.7.2) that only allows Client accounts to upload the attachment via this REST API. This will be fixed in our next release (WHD 12.7.3), but in the mean time, there is a workaround that should allow you to use the API.

You need to link your Tech account to a client admin tech account, as below:

1) Create Client account and link it to admin account you were previously using for uploading attachments from the script.
2) Assign the rights to this client so that he has edit rights for all locations and request types as location client admin. This is achieved through Setup > Locations > Default Client Admin permissions and Client Admins section
3) Check the tickets visibility in Client's User Interface.
4) Use credentials of this client to retrieve JSESSIONID/wosid and use following endpoint to upload attachments to existing tickets: POST: http://<host>:<ip>/helpdesk/attachment/upload?type=jobTicket&entityId=<integer>&returnFields=id&subscriberId=<integer>

0 Kudos
Level 8

Some additional information:

When capturing these requests in Fiddler, this is what it looks like from PowerShell:

 

POST https://whd/helpdesk/attachment/upload?type=jobTicket&entityId=165225&returnFields=id%2cuploadDate HTTP/1.1
Host: whd
User-Agent: Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.18362; en-US) PowerShell/7.0.2
Cookie: JSESSIONID=248DD535FA8D0130A88724FB19380B50; wosid=31gouHn9MVrwtMUFf8Ltdg
Content-Type: multipart/form-data; boundary="ef226f2f-6c07-4023-939b-9bc7021221ef"
Content-Length: 186

--ef226f2f-6c07-4023-939b-9bc7021221ef
Content-Disposition: form-data; name=file; filename=testAttachment.txt

This is a test attachment...
--ef226f2f-6c07-4023-939b-9bc7021221ef--

 

And this is what it looks like when sent from Postman: 

 

POST https://whd/helpdesk/attachment/upload?type=jobTicket&entityId=165253&returnFields=id,uploadDate HTTP/1.1
Cookie: JSESSIONID=248DD535FA8D0130A88724FB19380B50;wosid=31gouHn9MVrwtMUFf8Ltdg
User-Agent: PostmanRuntime/7.26.1
Accept: */*
Host: whd
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------------------------288816455342626980555920
Content-Length: 238

----------------------------288816455342626980555920
Content-Disposition: form-data; name="file"; filename="testAttachment.txt"
Content-Type: null

This is a test attachment...
----------------------------288816455342626980555920--

 

0 Kudos