problems creating test-case-folders with REST API

dbombardieri
Messages : 2
Inscription : mar. janv. 07, 2020 3:41 pm

problems creating test-case-folders with REST API

Message par dbombardieri » mar. janv. 07, 2020 3:54 pm

Hello
I'm trying to use REST API to create a test case folder

I make a REST call to the url http: //mysquashserver/squash/api/rest/latest/test-case-folders with the POST method and 2 headers:
- Authorization basic
- Content-Type header: application/json

body is:
{
   "_type": "test-case-folder",
   "name": "Test case folder 1",
   "description": "Description Test case folder 1",
   "custom_fields": [
     {
       "code": "cuf1",
       "value": "Cuf1 Value"
     }
   ]
   "parent": {
     "_type": "project",
     "id": 18
   }
}

the folder is not created
in the body of the answer I receive the list of the folder
as if i had run the GET method

the status code that I receive in response is 0200 (OK)
instead I would have expected 0201 (created)

am I doing something wrong ?
Thanks for your help

nobody help me ?
Dernière modification par dbombardieri le jeu. janv. 09, 2020 1:52 pm, modifié 1 fois.

chouaib
Messages : 2
Inscription : mer. janv. 08, 2020 12:20 am

Re: problems creating test-case-folders with REST API

Message par chouaib » mer. janv. 08, 2020 12:24 am

Hello,
I'm new to squash and I want to consume the rest API but there is no way to find a tutorial or an example to how it should look like. could you please helpl me I just need to know more about the Authorization basic part and how to do it.

It would be very helpful
Thank you

dbombardieri
Messages : 2
Inscription : mar. janv. 07, 2020 3:41 pm

Re: problems creating test-case-folders with REST API

Message par dbombardieri » mer. janv. 08, 2020 2:08 pm

<<could you please helpl me I just need to know more about the Authorization basic part and how to do it.>>

for Authorization you must insert a header with
Header name=Authorization
Header value =Basic xxx

where xxx should be the following string yoursquashusername:yoursquashpassword encoded in base 64

you can use this link https://www.base64encode.org/ to encode

chouaib
Messages : 2
Inscription : mer. janv. 08, 2020 12:20 am

Re: problems creating test-case-folders with REST API

Message par chouaib » jeu. janv. 09, 2020 1:12 am

Thanks a lot for your response that was very helpful

Répondre