Skip to main content

Create a ticket with an asset by API


Hi,

I am trying to use API to create a ticket, it is working fine without assets, but when I add an asset, it gives me an error message "We're sorry, but something went wrong. We've been notified about this issue and we 'll take a look at it shortly".


The request :
{ "helpdesk_ticket":{ "description":"Some details on the issue ...", "subject":"Support needed..", "email":"hulk@outerspace.com", "priority":1, "status":2, "source":2,"ticket_type":"Incident",

"assoc_asset_id":12, }, "cc_emails":"superman@marvel.com,avengers@marvel.com" }


(I already have an asset with ID=12 ) Can you advise?


Best,

Waseem

Did this topic help you find an answer to your question?
This topic has been closed for comments

10 replies

  • Contributor
  • 4 replies
  • January 31, 2017

Hi Waseem


Could you please try the below method and let me know if that works?


curl -u user@yourcompany.com:test -H "Content-Type: application/json" -d '{ "helpdesk_ticket": { "description": "Details about the issue...", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2 }, "associate_ci":{"serial_no":"ABC12345","name":"my printer","user":"rachel@freshdesk.com"} }' -X POST http://domain.freshservice.com/helpdesk/tickets.json


Regards

Radha



  • Author
  • Apprentice
  • 2 replies
  • February 1, 2017

Dear Rada,

I suppose that method will create a ticket and an asset "My printer", then assign that asset to the ticket.
I have tried it, it creates a ticket successfully without errors, but it does't create the asset "my printer".
However, I need to assign an existed asset to the ticket.

Best,
Waseem


  • Contributor
  • 4 replies
  • February 1, 2017

Hi Waseem


The code will not create an asset. It will create a ticket and link an existing asset that exist in your inventory.


In the above code, please mention the existing asset's serial number, name and used by details.


Will be glad to get on a call and help.


Regards

Radha


  • Author
  • Apprentice
  • 2 replies
  • February 1, 2017

Thank you for your help, it is working fine now :)

Waseem


  • Contributor
  • 4 replies
  • February 1, 2017

Thanks for the confirmation Waseem.


Please let me know for any further queries or assistance. Will be glad to help.


Have a great time ahead !


Thanks & Regards

Radha


  • Community Debut
  • 1 reply
  • August 30, 2017

I am getting same error message. How this was resolved please?


suvashini.balashanmugam
Contributor
Forum|alt.badge.img+4

Hello Avni,


Could you please help me with the error message that you're getting while running this command? Also let me know the command that you're trying so that we can analyse further?


Regards

Suvashini


  • Community Debut
  • 2 replies
  • March 26, 2018

Hello,

I tried creating a ticket in FreshService referring to the below link and created a ticket in FreshService successfully.

https://github.com/freshdesk/fresh-samples/blob/master/JAVA/httpclient4x/src/main/java/com/freshdesk/httpclient4x/CreateTicket.java


Now, I need to create a ticket with an associated Asset. I referred to the solution @Radhahad mentioned. But the ticket is not getting created, and I am getting the below response:

Response Status : 302

Response Body :

<html><body>You are being <a href="https://prakharsinha.freshservice.com/helpdesk/tickets.json">redirected</a>.</body></html>


Could anyone please help me creating a ticket with Asset using Java API.


Thanks & Regards,

Ganga


Hi Amutha,


You can construct a script to include payload like below,


{ "helpdesk_ticket": { "description": "Details about the issue...", "subject": "Support Needed...", "email": "tom@outerspace.com", "priority": 1, "status": 2 }, "associate_ci":{"serial_no":"C1MN8BGUDTY3"} }


The serial number is a mandatory field to associate a CI to a Ticket. Also, currently we only support default CI type Hardware to be associated with a Ticket. So, please verify if your code supports the same.


If still you are encountering issues around this please raise a support ticket and we are happy to assist with it.


  • Community Debut
  • 2 replies
  • April 5, 2018

Hi Thushan,


I raised a support ticket for the same and the issue is resolved. Since I am using v2.0 APIs, I used the below script to associate an asset with a ticket:


{"ticket":{"description":"Testing from Java ...","subject":"JAVA Support needed..","email":"amutha.ganga@erasmith.com","priority":4,"status":2,"type":"Incident","associate_ci":{"name":"Era Desktop"}}}


Thanks for your time.