How to get the services using the JIRA Service Desk API?

When I created the IT service Management Project from the existing templates that Atlassian provides, there was a field name Affected Services. Initially, the field had no values. So I went to Projects > Services and added a few services to it.

On the customer portal, these services are getting displayed.
image

But when I hit the API endpoint for Get request type fields, the response is as follows:

{
    "requestTypeFields":[
        {
            "fieldId": "customfield_10041",
            "name": "Affected services",
            "description": "",
            "required": false,
            "defaultValues": [],
            "validValues": [],
            "jiraSchema": {
                "type": "array",
                "items": "service-entity-field",
                "custom": "com.atlassian.jira.plugins.service-entity:service-entity-field-cftype",
                "customId": 10041
            },
            "visible": true
        }
    ]
}

The validValues is an empty array. On the API documentation, I couldn’t find an endpoint to get these values. So I wanted to know, is it possible to get these services using the Servicedesk API?

@DevdootMaji,

Similar to your labels question, I don’t know what constraints make you want to stick to the JSM/JSD API. In this case, assets have their own API: the Assets Platform APIs allow clients to search assets using GET /rest/assetapi/asset/search.

I appologise for following up so late on this issue but I am a bit confused. I am talking about the services that can be added into a service project created from the IT service management template. Here’s the image of it:

So in the image you can see that I have added 2 services: Jira & MsTeams. These 2 values are displayed on the Affected Services field on the customer portal.

What are assets, and will it return the service I just talked about?
I tried out the GET /rest/assetapi/asset/search endpoint but it returned an empty array.
API Response:

{
    "limit": 10,
    "size": 0,
    "values": []
}

On an open issue page, I found this undocumented API endpoint, which is used by the Affected Services field to suggest services: GET /rest/service-registry-api/service?query=
It did return the response I was looking for. Here’s the image for the API call:


(Note: I had to specify the ?query= in the API call to get all the values. Without that it was returning nothing.)

Is this the correct method to get services? Is there any other method that is documented and that Atlassian suggests to use?

@DevdootMaji,

Thanks for explaining in more detail. You haven’t missed anything. The ability to query affected services seems to be a feature request:
https://jira.atlassian.com/browse/JSDCLOUD-10015

Please watch, vote, and comment.