Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..
4279 views

restFul API call to start a flow on OO

Jump to solution

hi i went thru documentation and saw there is way to perform Execute a Flow by UUID using restful API in OO. 
i am new to the system like to check what is this UUID where can i find it and is this the only way to do it via rest API. 
For documentaiton: 
{
"uuid":"8d52dfc3-1de5-48d4-9c2a-887718de4696", “runName”: “run1”,
“logLevel”: “DEBUG”, "inputs":
{
"input1":"value for input1",
.
.
.
"inputn":"value for inputn"
}
}

YH

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Super Contributor.. JamesLindsay Super Contributor..
Super Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

I gave up trying with SoapUI and had much better success with Postman. I'm not sure why SoapUI gave me so much trouble.

With Postman I did the following:

I provided the Basic Authentication (which is automatically added as  a header. (See the API_Guide.pdf inthe documentation)

For the POST body I selected  raw and switched the type to JSON (application/json). This added the Content-Type header.

Because I still have CSRF Protection on (See the API_Guide.pdf inthe documentation) I needed to get a token value and add that header to the the POST because it uses the same session ID. To get it I just changed the method to GET

GET https://myhpoohost:8443/oo/rest/v2/executions
in the headers you find X-CSRF-TOKEN 7d38ef08-8563-4d93-b2df-8310948e5943
take this value, switch back to post and add the header X-CSRF-TOKEN and give it the value returned

Assuming you have a valid body

{
"flowUuid":"3ec8882d-22f8-4ab8-aec3-cced69161608",
"runName": "REST Test",
"logLevel": "STANDARD",
"inputs":
{
"Input1":"test1",
"input2":"test2",
"input3":"test3
 }

You should get the result you are looking for. I had to try it a few times to get in sync with the current session token.

Also, its seems like the RAS services on the Central server have to be running.

0 Likes
11 Replies
Micro Focus Expert
Micro Focus Expert

Re: restFul API call to start a flow on OO

Jump to solution

Hi,

In oo besides the path all flow related content has a unique identifier called UUID. In the case of cloudlsnag flows the UUID is replaced with the namespace of the flow, but that also has to be unique. Now how to find out the UUID:

1. Go to central's content management section.

2. In the flow library select a flow

3. The uuid/namespace will be shown under the ID field : https://ibb.co/mSPbkk

For all AFL flows this UUID cannot change without actually deleting the flow and creating a new one with the same name. For cloudslang it can change since it has to reflect the flow's position in the library tree, however such changes should be rare.

Regards,

Vlad

Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

thanks Vlad, i will check and test the calls using SOAP UI tester. 

0 Likes
Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

hi i did the soap call but i am receiving this error "A general error has occurred. Contact your administrator for more details." i have proper basic auth as well as the request body not sure what i did wrong. 😞

My Json request: 

{
"uuid":"d7a8fd3e-cfac-40ee-815f-2ea95df8857b",
"runName": "run1",
"logLevel": "DEBUG", "inputs":
{
}
} UUID.png

0 Likes
Bridges Respected Contributor.
Respected Contributor.

Re: restFul API call to start a flow on OO

Jump to solution

You know you are not making a soap call.  You are using the SoapUI tool to make a REST call to OO.

I'm not sure what version of OO you are using, but more than likely your resource should be: /oo/rest/v2/executions

0 Likes
Super Contributor.. JamesLindsay Super Contributor..
Super Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

I gave up trying with SoapUI and had much better success with Postman. I'm not sure why SoapUI gave me so much trouble.

With Postman I did the following:

I provided the Basic Authentication (which is automatically added as  a header. (See the API_Guide.pdf inthe documentation)

For the POST body I selected  raw and switched the type to JSON (application/json). This added the Content-Type header.

Because I still have CSRF Protection on (See the API_Guide.pdf inthe documentation) I needed to get a token value and add that header to the the POST because it uses the same session ID. To get it I just changed the method to GET

GET https://myhpoohost:8443/oo/rest/v2/executions
in the headers you find X-CSRF-TOKEN 7d38ef08-8563-4d93-b2df-8310948e5943
take this value, switch back to post and add the header X-CSRF-TOKEN and give it the value returned

Assuming you have a valid body

{
"flowUuid":"3ec8882d-22f8-4ab8-aec3-cced69161608",
"runName": "REST Test",
"logLevel": "STANDARD",
"inputs":
{
"Input1":"test1",
"input2":"test2",
"input3":"test3
 }

You should get the result you are looking for. I had to try it a few times to get in sync with the current session token.

Also, its seems like the RAS services on the Central server have to be running.

0 Likes
Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

yeah my bad was trying out rest API call via SOAP API. 

0 Likes
Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

@JamesLindsay wrote:

I gave up trying with SoapUI and had much better success with Postman. I'm not sure why SoapUI gave me so much trouble.

With Postman I did the following:

I provided the Basic Authentication (which is automatically added as  a header. (See the API_Guide.pdf inthe documentation)

For the POST body I selected  raw and switched the type to JSON (application/json). This added the Content-Type header.

Because I still have CSRF Protection on (See the API_Guide.pdf inthe documentation) I needed to get a token value and add that header to the the POST because it uses the same session ID. To get it I just changed the method to GET

GET https://myhpoohost:8443/oo/rest/v2/executions
in the headers you find X-CSRF-TOKEN 7d38ef08-8563-4d93-b2df-8310948e5943
take this value, switch back to post and add the header X-CSRF-TOKEN and give it the value returned

Assuming you have a valid body

{
"flowUuid":"3ec8882d-22f8-4ab8-aec3-cced69161608",
"runName": "REST Test",
"logLevel": "STANDARD",
"inputs":
{
"Input1":"test1",
"input2":"test2",
"input3":"test3
 }

You should get the result you are looking for. I had to try it a few times to get in sync with the current session token.

Also, its seems like the RAS services on the Central server have to be running.


 

hi james, thanks for the tips i tried using exactly what you indicated which i had basic auth in the header somehow it did not work. just to confirm is the post URL http://hostname-xxx:8080/OO/rest/v2/executions  ?

OO.jpg

0 Likes
Super Contributor.. JamesLindsay Super Contributor..
Super Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

try using "flowUuid" Anyway, it looks like your closer. Perhaps you have redirects disabled? Yes, that would be the correct POST url

Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution
Hi finally managed to get it working. i it was my mistake URL was /OO should have been in small caps and the soap UI was not working as well only managed to get it working using postman. Thanks a lot for your help.
Respected Contributor.. hpooStudent Respected Contributor..
Respected Contributor..

Re: restFul API call to start a flow on OO

Jump to solution

hi james, one question about the X-CSRF-TOKEN can we configure somewhere in OO to make it static so that it does not change OR maybe even disable it?

Cheers 
YH

0 Likes
dani_c Respected Contributor.
Respected Contributor.

Re: restFul API call to start a flow on OO

Jump to solution
That's the idea of an X-CSRF-Token, to be changed on every session. Though you can disable it, for that you need to follow the procedure from the API guide.

BR,
Daniel
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.