Wikis - Page

Using the API how to retrieve the GARs identifiers filtering by pipeline identifier?

0 Likes

Original Question: Using the API how to retrieve the GARs identifiers filtering by pipeline identifier? by Xavier Yuste Medina

Hi,

Using the API, I need to retrieve all the GARs entities identifier of one Pipeline, filtering by the pipeline identifiers

How I can do it?

Many thanks

Xavier Yuste


Verified Answer: RE: Using the API how to retrieve the GARs identifiers filtering by pipeline identifier? by ClaudioTercero

Hello Xavier,

This is a sample request using a query filter on pipeline ID field for GARs that might help:

<>/api/shared_spaces/1001/workspaces/1002/gherkin_automated_runs?fields=author,comments,description,id,pipeline,run_by,started,status,taxonomies&query="pipeline EQ {id IN 1002,1003,1004}"

*Specify the Pipeline IDs needed at the end of the query!

There is an API Interactive UI inside Octane that helps building the API requests for common entities.

You can find more details about it here:

https://admhelp.microfocus.com/octane/en/16.1.100/Online/Content/API/Interactive_API.htm

More information about query filters is here:

https://admhelp.microfocus.com/octane/en/16.1.100/Online/Content/API/query_Clause.htm 

If this helps please suggest it as a valid answer.

Thanks!

Claudio


Question: RE: Using the API how to retrieve the GARs identifiers filtering by pipeline identifier? by Xavier Yuste Medina

Hi Claudio,

Many thanks for your answer, I am trying to apply your suggestion, I am executing a Java code with Rest Assured library.

Response respPipelines = RestAssured.given().headers("Content-Type", ContentType.JSON).relaxedHTTPSValidation()
.proxy(proxyURL).cookies(cookies).when()
.get(""https://almoctane-eur.saas.microfocus.com/.../" + workspaceId
+"/gherkin_automated_runs?query=\"pipeline={id EQ 72035}\"");

And I have the next error:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid number of path parameters. Expected 1, was 0. Undefined path parameters are: id EQ 72035.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

DO you have any idea about this error?

Many thanks again!!!!
Xavier


Question: RE: Using the API how to retrieve the GARs identifiers filtering by pipeline identifier? by Xavier Yuste Medina

Hi

I have found the solution, adding the query as  queryParam :

Response respPipelines = RestAssured.given().headers("Content-Type", ContentType.JSON).relaxedHTTPSValidation()
.proxy(proxyURL).cookies(cookies).when().queryParam("query", "\"pipeline={id EQ 20001}\"").
get(""https://almoctane-eur.saas.microfocus.com/.../" + workspaceId
+"/gherkin_automated_runs");

And now it works and I can retrieve the GAR's of the specified pipeline Thanks Claudio!

Regards

Xavier

Labels:

Other
Support Tips/Support Tips/Support Tips/Knowledge Docss
Support Tips/Support Tips/Knowledge Docs
Support Tips/Knowledge Docs
Comment List
Related
Recommended