I can't create any resource using POST

Hi, I tried to create resource, folder, group but I always get error that says “The name should not be empty.” I use curl like below:

curl --request POST
–url passbolt_url/folders.json
–header ‘Authorization: Bearer myToken’
–data ‘{
“name”: “myfolder”
}’

and i got output like below:

{
“header”: {
“id”: “59372b89-6344-47ca-ac4e-9d31ed513c76”,
“status”: “error”,
“servertime”: 1733408033,
“action”: “02e18a01-42f6-5e5d-b18f-2ee9070e3b9d”,
“message”: “Could not validate folder data.”,
“url”: “/folders.json”,
“code”: 400
},
“body”: {
“name”: {
“_empty”: “The name should not be empty.”
}
}
}

Do you have any idea what I did wrong? MyToken is proper - if i misspell it I get another error.

Hello @bartwatr

I was able to reproduce the issues and had the same error using your cURL request, after comparing it looks like you missed:

  --header 'Content-Type: application/json' 

Can you try adding this header and let us know?

Thank you for answering my question. I tried and it worked!

I didn’t find it in API guide:

Should I add it for other POST calls (for groups, resources) also?

Thank you!

Ok, I checked and it works also when I add it to POST request for groups and resources :slight_smile:

1 Like

We will update our documentation in order to add the missing header for requests containing data. Thanks for your report! :metal:

1 Like