PractiTest Discussion Forum

Creating test sets via the api states "Project must exist"

Hi,
I am attempting to create test sets using the related api endpoint described by the following api documentation page:
https://www.practitest.com/api-v2/#create-a-testset

When submitting the request, the response is the following:
422 Unprocessable Entity
with the message "Project must exist"

All other calls, like getting tests, test sets, instances, test runs work with the same project in the url, so does creating test runs for instances.

Any idea what I might be doing wrong? :slight_smile:

Here is the body I am using with the request:
{"data": {"type": "sets", "attributes": {"name": "Some automated tests (Postman generated)"}}}

Hello!
This message might indicate, that in a project you’re trying to create Test Sets in, there is a Custom Field called “Project”, and it is a Mandatory field on a Test Set level.
In this case, you have to fill this field with a value each time you send a POST request of Test Set creation.
In order to check and retrieve this field’s system ID, you can use the following request: Full API Documentation (Version 2) - PractiTest

In addition, please check the URL itself and make sure that the project ID appears correctly: https://api.practitest.com/api/v2/projects/YOUR_PROJECT_ID/sets.json

Please let us know if it helped and you managed to send the request!

Alex

1 Like

Ah amazing, I managed to get it working. :pray:

Indeed it was a custom field called “Project” that I needed to use.

Thank you kindly for the helpful tip.