Getting 400 Unauthorized error while creating baseline on GC stream using Rest/OSLC APIs
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
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.KT PD
Jun 01 '23, 4:10 a.m.Michael Rowe
FORUM ADMINISTRATOR / FORUM MODERATOR May 31 '23, 1:37 p.m.KT PD
May 31 '23, 3:02 p.m.KT PD
Jun 01 '23, 4:10 a.m.