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

While trying to fetch all components of a project area in GCM, 400 Bad request error

 Hi,


We were trying to fetch all components of a GCM projetc area using Rest API,

This above query fetches all components perfectly fine but later after 10 or 15 mins same server call is requested then we get 400 Bad request error.

We are using cookies to authenticate. We have an application created in low code platform which integrates GCM project area data.

Please let us know how to fix this issue.

Thanks & Regards,
Thiru

0 votes

Comments
FYI you're using the OSLC Query capability for components offered by GCM - there's one to query within a project and another to query components across the application, this particular query is within a project.

What version and ifix are you using? Have you tried updating to the latest ifix?

How do you get your authentication cookies? Could they have expired between the requests?

Have you confirmed by checking the messages sent (i.e. _not_ by _assuming_ that they're correct) that the URL/headers/cookies on the failing request are the same as the succeeding request?

Have you made the identical request (URL, headers) using a logged-in browser REST client, twice, 10 minutes apart - does it work there? If so you're doing something wrong in your code probably to do with headers/cookies.

Check gc.log for any associated errors.

I hope you are using OSLC discovery to determine that query base URI of an OSLC query capability and not hard coding or constructing the URI https://localhost/gc/oslc-query/components/_FWAMUDJjEey62-ishdsdfsr.That query base URI is for a specific project area. If that project area is archived, that query capability should return an error response.

As Ian suggests, first try using a logged-in browser REST client.

So far, there is insufficient information to answer your question.


Accepted answer

Permanent link

Since this works using RESTclient and Postman, this suggests this is not a GCM server issue, but an error with your Java client code, perhaps relating to authentication. I can't help you further with that.

Michael Rowe selected this answer as the correct answer

0 votes

Comments

Closing this question as accepted 


One other answer

Permanent link

 Hi,


We have tried in Rest Client and it works fine.

Please find the answers for the questions asked by Ian,

you're using the OSLC Query capability for components offered by GCM - there's one to query within a project and another to query components across the application, this particular query is within a project.
    ---- Yes, We need to query for a project. Find all components of a project area.

What version and ifix are you using? Have you tried updating to the latest ifix?
    ----- We are using ALM 7.0.2 ifix008

How do you get your authentication cookies? Could they have expired between the requests?
    ------ From the last request made we try to fetch cookie and store it local variable.
    ------ No. it does not expires between the requests. Request is made after few minutes.  

Have you confirmed by checking the messages sent (i.e. not by assuming that they're correct) that the URL/headers/cookies on the failing request are the same as the succeeding request?
   ------- Yes. Keeping the latest success request and after few minutes again another request is made. it fails with 400 response error. (Bad request) 

Have you made the identical request (URL, headers) using a logged-in browser REST client, twice, 10 minutes apart - does it work there? If so you're doing something wrong in your code probably to do with headers/cookies.
   ------- In Rest Client and Postman is working fine, but in both we don't need to send any cookie to authenticate the API, But in our integrated application we need to send because they use cookies as an authentication.

0 votes

Comments
Your answer to my 'have you confirmed' question is rather vague - it sounds like you haven't actually checked the URL and the headers and the cookies of the failed request are actually identical to the successful request. Mistaken assumptions are often just wrong guesses. Check them! 

Just checked here and when I do a GCM query the response sends a set-cookie for JAZZ_AUTH_TOKEN - does your code handle updating cookies with every request/response? It should. This is also key to keeping logged in, because if your code tries to do an explicit log in only on some assumed auth timeout period then it's bound to fail in the end. Much better to authenticate on demand by examining _all_ responses (even 200) and check if auth needed then do it.

As David says, the problem is entirely in your code because the REST client test shows that there's no problem in the GCM application.

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
× 10,950
× 7,505
× 1,335
× 235
× 33
× 18

Question asked: Feb 09 '22, 6:58 a.m.

Question was seen: 1,670 times

Last updated: Oct 19 '23, 3:50 p.m.

Related questions
Confirmation Cancel Confirm