cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Return the status of executed Pipelines for the specified time within the Org

RavNeu
New Contributor II

I am new to snaplogic so please bear with me!
I am trying to build a pipeline to extract the pipeline execution history for specified time range using GET REST snap. I could see below Query in the documentation:
GET https://elastic.snaplogic.com/api/1/rest/public/runtime/orgname?start=&end=>

has anyone used this api? how can I pass the value of start and end dates?

I donโ€™t want to hard code these dates as i want to make my pipeline more dynamic. I want to pass start date as first day of the previous month and end date as the last date of the previous month.
image

I got above error while I try to create a snap. it says error on the index 87 which is โ€œ>โ€ in the api query. So, I removed โ€œ>โ€ and only used
https://elastic.snaplogic.com/api/1/rest/public/runtime/orgname?start=&end=

but still got below error:
Failure: REST API service endpoint returned error result: status code = 404, Reason: REST API service endpoint returned error result: status code = 404, reason phrase = NOT FOUND, refer to the error_entity field in the error view document for more details, Resolution: Please check the values of Snap properties.
Any help will be appreciated!

5 REPLIES 5

tlikarish
Employee
Employee

Welcome to the community.

The start and end parameters can be passed in via the query string. The snap can take care of that for you. Youโ€™ll have to make a couple changes.

Screen Shot 2022-06-23 at 1.42.32 PM

  1. Youโ€™ll need to modify the Service URL to include everything up to the question mark, eg. https://elastic.snaplogic.com/api/1/rest/public/runtime/abc123

  2. Modify the Query parameters to so that the left column, which is the query parameter key, looks like start and the left could look like _START.

  3. Then youโ€™ll need to modify the Pipeline so that it has a Pipeline Parameter called START.

Do steps 2 and 3 again for the end query string parameter.

To make your pipeline dynamic, you could look at this documentation for more information.

RavNeu
New Contributor II

Thank you @tlikarish

I made the changes as you suggested but I am still getting error:

image

here is the pipeline property i have :
image

Error I am getting:
Failure: REST API service endpoint returned error result: status code = 400, Reason: REST API service endpoint returned error result: status code = 400, reason phrase = BAD REQUEST, refer to the error_entity field in the error view document for more details, Resolution: Please check the values of Snap properties.

Not sure what I am missing. ๐Ÿ™

Hi RavNeu,

Did you ever figure out why you received the error?

Failure: REST API service endpoint returned error result: status code = 400, Reason: REST API service endpoint returned error result: status code = 400, reason phrase = BAD REQUEST, refer to the error_entity field in the error view document for more details, Resolution: Please check the values of Snap properties.

Hi All,
Just to share my experience: to retrieve runtime statuses, I use the following endpoint: https://elastic.snaplogic.com/api/1/rest/public/runtime/%1$s?last_hours=%2$s&limit=%3$s&offset=%4$s, that I call .sprintf() on it with following variables:

  • %1$s is replaced by my Org
  • %2$s is replaced by a number of hours from now in the past
  • %3$s and %4$s are used by pagination

This is associated with my personal account, stored as REST Basic Auth account.

Hope this helps!