cancel
Showing results for 
Search instead for 
Did you mean: 

Returning customfield names instead of ID via API

SOLVED
ihsb
New Contributor

Returning customfield names instead of ID via API

On Zephyr Scale 8.0.2, the /testcase/search API returns a customFieldValues field (despite the API doc mentioning it as customFields). This only shows the ID of the customfield and selected option for a Single List.

For example -

"customFieldValues": [
    {
        "intValue": 420,
        "customFieldId": 138
    },
    {
        "intValue": 425,
        "customFieldId": 139
    }
]

This is useless until you call /project/{project_id}/customfields/{component} (which is undocumented) and properly map it to something meaningful. Unless I'm mistaken, this seems to be the method I could find. Is there any other way to do it to reduce the code on our end?

1 ACCEPTED SOLUTION

Accepted Solutions
jfelix
Staff

Re: Returning customfield names instead of ID via API

Hi, @ihsb! Thanks for your question.

In the latest version of the app (8.0.3), you can use the REST API and get all the information related to custom fields.

 

For example, GET /rest/atm/1.0/testcase/search?query=projectKey = "{{projectKey}}" AND folder = "/{{folderName}}" should result in a response similar to this one:

 

[
    {
        ...
        "customFields": {
            "datepicker": "2019-02-20T03:00:00.000Z"
        },
        ...
        "testScript": {
            ...
            "type": "STEP_BY_STEP",
            "steps": [
                {
                    "testData": "",
                    "customFieldValues": [
                        {
                            "booleanValue": true,
                            "id": 126265,
                            "customField": {
                                "archived": false,
                                "name": "checkbox - ts",
                                "index": 0,
                                "id": 38,
                                "type": "CHECKBOX",
                                "projectId": 10007,
                                "required": false
                            }
                        }
                    ],
                }
            ]
        },
    }
]

 

 

Do you see a different response schema when trying this endpoint?

View solution in original post

2 REPLIES 2
jfelix
Staff

Re: Returning customfield names instead of ID via API

Hi, @ihsb! Thanks for your question.

In the latest version of the app (8.0.3), you can use the REST API and get all the information related to custom fields.

 

For example, GET /rest/atm/1.0/testcase/search?query=projectKey = "{{projectKey}}" AND folder = "/{{folderName}}" should result in a response similar to this one:

 

[
    {
        ...
        "customFields": {
            "datepicker": "2019-02-20T03:00:00.000Z"
        },
        ...
        "testScript": {
            ...
            "type": "STEP_BY_STEP",
            "steps": [
                {
                    "testData": "",
                    "customFieldValues": [
                        {
                            "booleanValue": true,
                            "id": 126265,
                            "customField": {
                                "archived": false,
                                "name": "checkbox - ts",
                                "index": 0,
                                "id": 38,
                                "type": "CHECKBOX",
                                "projectId": 10007,
                                "required": false
                            }
                        }
                    ],
                }
            ]
        },
    }
]

 

 

Do you see a different response schema when trying this endpoint?

View solution in original post

ihsb
New Contributor

Re: Returning customfield names instead of ID via API

Hi @jfelix,

 

Thanks for the response. It seems like I was using /rest/tests/1.0/ instead of the /rest/atm/1.0 endpoint. I'm assuming that one is for internal API calls. Not sure how I mixed them up.

 

Thanks for your help.

New Here?
Join us and watch the welcome video:
Top Kudoed Authors