Highlighted
Absent Member.
Absent Member.
3062 views

Error while executing flows using rest API's.

Jump to solution

 I am working on HPOO tool rest API's.

I am getting  X-CSRF-TOKEN error while running content flow using rest api even though I included X-CSRF-TOKEN in headers.

I am attaching the screenshot, can you please help me resolve this??? 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

Hi,

As the error says, the CSRF token is incorrect. Note that the token changes every time a new session starts, so make sure you are using the current one.

  • Change the request method from POST to GET, and send the request (it's just a dummy request).
  • Go to the response headers and copy the current CSRF token, then update it in the request headers.
  • Change the request method back to POST, and send the request.

That should sort out the "Forbidden" issue, but I'm still not sure if your request body is correct. I think you need to change it from "form-data" to "raw" and enter a JSON structure (as shown in the API Guide).

HTH,
Rotem

View solution in original post

0 Likes
11 Replies
Highlighted
Absent Member.
Absent Member.

Hi,

Can you please send the headers of your HTTP POST request?  

Thanks, 

Gal

0 Likes
Highlighted
Absent Member.
Absent Member.

I attached header's screenshot.

0 Likes
Highlighted
Absent Member.
Absent Member.

Thank you. The header seems OK, However, your are using "latest" in your API request instead of using the specific API version (e.g., V1). It can cause some compatibility issues. Try to change it to the actual version and try again. 

Also before you give it another try,  do a new dummy GET call and take a fresh CSRF token from there. 

What version of OO are you using? 

Let me know if that works. 

Gal

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

I am using  HP_OO_Community_Edition (soft ware version: 10.60 ).

Now I am facing another issue. I attached the screenshot.

please look into that. 

Thanks.

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

The URL seems wrong - instead of /oo/trigger.html it should be: /oo/rest/v2/executions

Also, it would useful to see what your request body actually looks like (the raw JSON sent to the server).

HTH,
Rotem

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

I am using the following url's:

http://******:8080/oo/rest/executions,

http://******:8080/oo/rest/v2/executions.

But still i am getting issue. I attached the screenshots.

please look into that. 

Thanks.

 

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

As the error says, the CSRF token is incorrect. Note that the token changes every time a new session starts, so make sure you are using the current one.

  • Change the request method from POST to GET, and send the request (it's just a dummy request).
  • Go to the response headers and copy the current CSRF token, then update it in the request headers.
  • Change the request method back to POST, and send the request.

That should sort out the "Forbidden" issue, but I'm still not sure if your request body is correct. I think you need to change it from "form-data" to "raw" and enter a JSON structure (as shown in the API Guide).

HTH,
Rotem

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi ,

It's working fine now.
I have a requirement where i am supposed to capture the response of "Http Client Post" which is a part of a flow which i have designed. Now I need to trigger that flow using HP OO Rest API call.  Is it possible get the response of the "Http Client Post" while triggering a flow using HP OO Rest API call. I attached the screenshots.

please look into that. 

Thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,.

Unfortunately, this cannot be done with a single REST request. You can do it with a combination of requests. After you trigger the run, you can use this request to check the run status:

GET /oo/rest/v2/executions/Run ID/summary

And this request to get the step data:

GET /oo/rest/v2/executions/Run ID/steps

Replace Run ID with the ID you got in the first request (in your screenshot: 101000180).

 

You can filter the steps to fit your needs - see the API Guide for details.

Regards,
Rotem

0 Likes
Highlighted
Absent Member.
Absent Member.

Hi,

It's working fine.

thanks.

0 Likes
Highlighted
Absent Member.
Absent Member.

does anyone have the documentation for rest api in ucmdb . having issues with hpln. could not get it from hpln website.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.