Getting 400 Unauthorized error while creating baseline on GC stream using Rest/OSLC APIs
![](http://jazz.net/_images/myphoto/aa3c892db3c3217498d9ce65e641c002.jpg)
Hi Team,
We are using IBM tool chain with version 7.0.2.
We are trying to create baseline using POST method on GC streams with following details:
1. Method: POST
2. URL: https://<Server_name>/gc/api/createBaseline
3. Body:"@prefix oslc_config_ext: <http://jazz.net/ns/config_ext#>
<https://<Server_name>/gc/api/createBaseline>
oslc_config_ext:titleTemplate "{0} Example baseline (2023-05-31)" ;
oslc_config_ext:rootConfiguration <https://<Server_name>/gc/configuration/12>"
4.Content-Type:text/turtle
Using this we are getting below error:
400 unautherised
After giving credentials also it is not able to create
Anyone please help me
Thanks
Accepted answer
![](http://jazz.net/_images/myphoto/aa3c892db3c3217498d9ce65e641c002.jpg)
You're missing a space and a dot (period) on the end of your prefix line - without that I get a 500 error. If you get a 403 error read the response content and add the header it tells you to.
@prefix oslc_config_ext: <http://jazz.net/ns/config_ext#> .
<https://<Server_name>/gc/api/createBaseline>
oslc_config_ext:titleTemplate "{0} Example baseline (2023-05-31)" ;
oslc_config_ext:rootConfiguration <https://<Server_name>/gc/configuration/12>
With it I get the expected 200 response and the Location header in the response gives the tracker; the baseline is created. I have to change the titleTemplate to create another new baseline because it quite reasonably won't let you create a baseline with an already-existing title.
Not sure how you get a 400 error; perhaps basic auth isn't working.
Comments
Michael Rowe
FORUM ADMINISTRATOR / FORUM MODERATOR May 31 '23, 8:07 a.m.What authentication are you using? All POSTs do require authentication with the server.
KT PD
Jun 01 '23, 4:10 a.m.I am using basic auth method
Michael Rowe
FORUM ADMINISTRATOR / FORUM MODERATOR May 31 '23, 1:37 p.m.Have you confirmed that the user id you are passing in the POST has permission to create baselines in the project area you are executing against?
KT PD
May 31 '23, 3:02 p.m.Yes that userid is having all configuration related permissions including creating baselines
KT PD
Jun 01 '23, 4:10 a.m.Hi,