webinarAttend our Q3 feature roundup webinar on November 21, 2019 Save your Seat

Start a new topic
Solved

API Update Ticket with Service Request

If I want to update a Service Request item. 


with the following


@"

{

  "priority" : 1,

  "status" : 2

}

"@


But when I run my code I get this....

Invoke-RestMethod : {"description":"Validation failed","errors":[{"field":"type","message":"It should be one of these values: 'Incident'","code":"invalid_value"}]}

At 


I don't want to update the "type" field because it is already set to 
"type": "Service Request", if I change this to "type": "Incident",
It works but lose all information on the Item.
If I add "type": "Service Request" to the code it does not work.... 


Does someone know how to bypass the error.... Or another workaround?
@Fresh please update you're API....

Hi Sjoerd,


Looks you are using API V2 to update a Service Request and it fails as API V2 doesn't support Service items. We are enhancing the API V2 across all the modules and should be available in the nearest updates. You can make use of API V1 for Service items. 


Hope this sounds helpful. 

Hello


I just tried to update a Service Request like Sjoerd. I cannot use API V1 and V2 doesn't support this function still.

Is there any Update?


Thanks.

I am having an issue with Service Requests as well in V1.  Have a ticket opened.   If I find anything out I will share it here.

Hi Sid,

 

I hope we were able to help you over the ticket. It looks like you'd like to update the ticket field property for a service item and this can be accomplished through API Version 1 and the Service item API V1, will help you to modify/update the custom fields of the service item.

 

Let's say if you'd like to update a service item's ticket property, then you can use the below query,



curl -u user@yourcompany.com:test -H "Content-Type: application/json" -X PUT -d '{ "helpdesk_ticket": { "priority":1, "status":2 }, "custom_field":{"fieldname_67135":test}}' https://domain.freshservice.com/helpdesk/tickets/1.json

 

 

If you like to update a custom field of that specific service item, 

 

curl -u APIKEY:X -H "Content-Type: application/json" -X PUThttps:// domain .freshservice.com/catalog/request_items/4/purchase_order.json -d'{"requested_item_values":{"4":{"item_id":"3000282076","quantity":"3"},"12":{"item_id":"3000282084","requested_item_value_attributes":{"3000282084":"patrick jane"}}},"requested_for": "thushan@netflixdesk.com"}'


I hope this helps.


Thanks for using Freshservice! 


Thanks, 

Vaishali

Login or Signup to post a comment
JS Bin