Unable to create service request by API

We are unable to create a service request from a catalog item.

We have reviewed the documentation at:
https://api.freshservice.com/#create_a_service_request
note: sorry for the spaces in the url, it indicated only allowed to use 2 urls

it shows that we need the “item_id” for submitting a request. what is not documented is WHERE to get the item_id. is this just the catalog id or some other ID?

when we retrieve an existing manually created ticket we see 3 “ID”

{
“requested_item”: {
“id”: 25000816737,
“service_request_id”: 25010108683,
“quantity”: 1,
“created_at”: “2020-02-25T14:58:01-05:00”,
“updated_at”: “2020-02-25T14:58:01-05:00”,
“remarks”: null,
“from_date”: null,
“to_date”: null,
“location_id”: null,
“item_type”: 1,
“requested_item_values”: {
“Date Required (minimum 2 weeks from request date)”: “2020-02-28T00:00:00+00:00”,
…,
“General Comments”: null
},
“stage_name”: “Requested”,
“catalog_item”: “My Request v2”,
“item_display_id”: 79
}
}

here are the 3 id’s.
“id”: 25000816737,
“service_request_id”: 25010108683,
“item_display_id”: 79 <-- this is the catalog item in the base “URL”

when we submit our request:
{
“requested_item_values”:{
“[item_display_id]”:{
“item_id”:“25000816737”, <-- this is the id we are not sure where to obtain
“quantity”:“1”,
“requested_item_value_attributes”:{
our key value pairs
}
}
},
“requested_for”:"me@company.com",
“requester_email”:"me@company.com"
}

to the url: /catalog/request_items/79/service_request.json

we simply get the not useful response:
{
“status”: false,
“error_code”: 400,
“errors”: “Requested Item detail is not present”
}

note: we tried all 3 IDs and it didn’t work for any of them.

searches for this error show past community discussions but they were never answered.

Hi @Justin_Marshall_dsg,

I could not get what item_id would be pointing to as well from the documentation. I will discuss with the internal product team to understand this item_id attribute and will post the answer here soon.

@Justin_Marshall_dsg The API documentation is missing as to where [item_id] has to be fetched from.
I will report it to the internal team to properly update it.

In short,
[item_id] can be obtained from API (View Item Details For A Particular Item)
https://api.freshservice.com/#view_item_details_for_a_particular_item
catalog_item: {
“id” : 27000193815,
“display_id” : 32
}

NOTE: id of the above json is the [item_id] to be used in
https://api.freshservice.com/#create_a_service_request

In Detail,

To create a Service Request, user must know the following.

  1. Catalog Item details - to which he is gonna raise request
    Get the Catalog Item details by hitting the correct URL
    https://api.freshservice.com/#view_item_details_for_a_particular_item

  2. Note down. “id” and “display_id”
    Example:

    catalog_item: {
    “id” : 27000193815,
    “display_id” : 32
    }

  3. Go to create service request API
    https://api.freshservice.com/#create_a_service_request

Replace [item_display_id] by ‘display_id’ of step 2.
Replace item_id by ‘id’ of step 2.

We were able to succesfully create a service request! thanks for the help.

2 Likes

Thanks for your confirmation @Justin_Marshall_dsg! :slight_smile: