PractiTest Discussion Forum

Unable to upload required custom field

I have created custom field Browser on Run level through UI as required, now I am trying to upload browser through API as following:

{
“data”: {
“type”: “runs”,
“attributes”: {
“instance-id”: instanceID,
“exit-code”: 0,
“custom-fields”: {
“Browser”: “Chrome”
}
},
“steps”: {
“data”: [
{
“name”: “Step One”,
“expected-results”: “result111”,
“actual-results”: “actualno”,
“status”: “FAILED”
}
]
}
}
}

My response:
{
“errors”: [
{
“status”: 422,
“title”: “could not save the test results [“Custom field Browser should not be empty”]”
}
]
}

I am following example on practitest documentation, seems like my request is still incorrect, please advice how to fix it.
Thank you!

Hello Arman,
Please note, that in “custom fields” section in the attributes, you cannot write the name of the Custom Field.
What you need to write is its System ID in the following format:
“—f-XXX”: “Chrome”, where XXX is the ID of the field.
You can retrieve the ID by using this GET request if you’d like to do it automatically: Full API Documentation (Version 2) - PractiTest
Alternatively, you can retrieve it from the URL of the field’s setting page:

1 Like

I’m trying to do the same thing to no avail.
I’m posting to the runs API:
POST https://api.practitest.com/api/v2/projects/YOUR_PROJECT_ID/runs.json

      const data =
      {
        "data": {
          "type": "runs",
          "attributes": {
            "instance-id": testInstance,
            "version": "1.6",
            "custom-fields": { "---f-185629": "0.8" },
            "Assigned To": "QE Automation Bot"
          },

          "steps": {

            "data": [

              {
                "name": `${test.title}`,
                "expected-results": `${test.expectedStatus}`,
                "status": `${result.status.toUpperCase()}`,
                "description": "Test step's description",
              }
            ]
          }
        }
      }

The API responds with a successful post but the test instance is never updated. I’m trying to create filters that I can use to create new dashboard item reports.

I created a simple filter with the custom field as the only filter so I only get runs in the filter from my automated runs with the custom version number.

The run and latest run are updated, but it’s not adding the custom field.