Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

0 votes

Comments

What authentication are you using?  All POSTs do require authentication with the server. 

 I am using basic auth method

Other Post requests are working using same.

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? 

Yes that userid is having all configuration related permissions including creating baselines 

 Hi,

Anyone let me know the body I am passing in post method is correct or need some modifications

Thanks 


Accepted answer

Permanent link

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.

KT PD selected this answer as the correct answer

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: May 31 '23, 4:53 a.m.

Question was seen: 337 times

Last updated: Jun 01 '23, 4:10 a.m.

Confirmation Cancel Confirm