How to get all deployment process request within a Timeframe using UrabanCode Deploy REST API? - deployment

I am looking for REST API option in UrabanCode Deploy to get all deployment process within a particular time-frame. Let's say
- All deployment process request id submitted within 24 hours.
- All Deploy process request submitted in Last 7 Days etc.
I have checked the possibility in applicationProcessRequest Rest API with filterValue option as suggested in this question but no luck. Its displaying all process request.
http://localhost:8443/rest/deploy/applicationProcessRequest/table?filterValue_submittedTime=1473282726868
I am looking filter option to limit the result based on date field.
Does anyone know UrbanCode REST API that return all applicationProcessRequest id's within a time-frame?
I will really appreciate your help. Thanks.

We can get list of deployment process request id from /rest/report/adhoc endpoint.
Parameters are:
dateRange: custom, currentWeek, currentMonth
date_low: UnixTimestamp in milliseconds (Required if dateRange is
custom)
date_hi: UnixTimestamp in milliseconds (Required if
dateRange is custom)
orderField: Order field
sortType: Sort type asc/desc
type: Report type
com.urbancode.ds.subsys.report.domain.deployment_report.DeploymentReport
Syntax:
http://localhost:8443/rest/report/adHoc?dateRange=custom&date_low=<START_DATE>&date_hi=<END_DATE>&orderField=application&sortType=asc&type=com.urbancode.ds.subsys.report.domain.deployment_report.DeploymentReport
e.g
http://localhost:8443/rest/report/adHoc?dateRange=custom&date_low=1472702400000&date_hi=1474430400000&orderField=application&sortType=asc&type=com.urbancode.ds.subsys.report.domain.deployment_report.DeploymentReport

Related

Specify Global Time Range on Azure DevOps API Calls

I am using the Azure DevOps API to put together a report of build metrics. I am looking for a way to add a global time range query parameter to my calls, so that I am only querying items that occur within the range of time x and time y.
It appears some specific calls contain a query parameter such as a "creationDate" or "startTime"; however I am unable to find a way to globally limit the date range of API calls I make. I am using a large selection of REST endpoints and many either do not contain a time range query parameter or use a different implementation method to accomplish the same thing.
In short, I am looking for a way to globally limit the Azure DevOps REST API with either a query parameter or an API key setting to return results within a specific range. Is this possible?
I am looking for a way to specify a time range such as "get all builds
that ran within the last week" or "get all pipelines created within
the last month" without modifying my code to parse these elements from
each response.
If so, agree with Krzysztof Madej, if the rest api does not provide parameters to specify the date range, there should be no out-of-the-box method to achieve this demand.
The Builds-List rest api provides parameters such as maxTime, minTime to specify the date range, while the Pipelines-List rest api does not provide such parameters to specify the date range.
So, if you don’t want to modify the code to parse these elements from response, I think this is currently impossible.

Magnolia REST API

Is there any way to request Magnolia REST API for list of products
which could be retrieved with equivalent of JCR SQL2
select * from [mgnl:product] where productName like '%Nikon%'
If it's only possible with custom rest end-point could you please point to tutorial.
Update as of Magnolia REST 2.1, using the v2 endpoint definition:
To answer the second question about node-types, here's what it looks like, as a YAML file in a light module, e.g. <module-name>/restEndpoints/delivery/my-products_v1.yaml:
class: info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpointDefinition
workspace: products
rootPath: /
includeSystemProperties: false
bypassWorkspaceAcls: true
depth: 2
nodeTypes:
- mgnl:product
childNodeTypes:
- mgnl:contentNode
The Delivery endpoint config takes node-types to include.
nodeTypes specify the primary list of JCR node types to query—in your case mgnl:product;
childNodeTypes specify which child-nodes to include as JSON objects under the primary results, when depth is greater than 0.
With the above configuration, you may run the following requests to query products or get a single product, respectively:
GET <host>/.rest/delivery/my-products/v1?productName[like]=%25Nikon%25
GET <host>/.rest/delivery/my-products/v1/path/to/Nikon-1
This differs from Magnolia's former Nodes endpoint, which is not configurable, but only lets consumers exclude node-types.
Yes, you can use content delivery endpoint to do so. Syntax is like: GET /delivery/{endpoint-prefix}/v1?key1=value1&key2=value2
See https://git.magnolia-cms.com/projects/MODULES/repos/rest/browse/magnolia-rest-content-delivery for more details.

REST API design resource time bound

Recently I was asked to build a RESTful API that would retrieve Offers which are time bound (have an expiry time), such that subsequent querying on the resource should reflect the changes.
My approach (POST) was to send a $timestamp value within the object body so it is part of the request:
{ "itemID":1,
"itemName":"item1",
"itemTimestamp":"{{$timestamp}}",
"itemPrice":4.65,
"offerPeriod":"4m",
"offerTimeLeft":"NA" }
Note now that the offerPeriod key: "4m" corresponds to 4 minutes life time of that specific resource.
I have designed the API in such a way, that subsequent querying to that particular resource would first validate/check if the query time is within the expiry period, if it is then update the timeleft value, else DELETE the resource.
Could someone highlight how / where have I violated REST constraints.
https://github.com/Datahman/ScalaRESTSpray
Many thanks.

Retrieving Microsoft Live calendar events between 2 dates

I'm currently working on requesting a list of events between 2 dates via Microsoft Live's REST API. I am able to pull back a list of events through the following request URL:
https://apis.live.net/v5.0/me/events
However, this returns a list of events that does not have any specific date frame. For example, I'd want to call a request similar to this:
https://apis.live.net/v5.0/me/events?startDate=2015-02-15&endDate=2015-03-15
I haven't been able to find any useful Microsoft documentation in their disorganized mess of "documentation", so my questions are:
1 - What changes need to be made to the first endpoint above for something like this to work?
2 - What time format does Microsoft use for this kind of request?
Thanks!
I finally found the answer in the middle of a Microsoft documentation page.
Get a limited number of events based on their starting and ending times in Coordinated Universal Time (UTC) format by using the start_time and end_time parameters
To answer my own questions:
#1 - The following endpoint works:
https://apis.live.net/v5.0/me/events?start_time=2015-02-15T00:00:00Z&end_time=2015-03-15T00:00:00Z
#2 - The time format is as follows:
yyyy-MM-dd'T'HH:mm:ss'Z'

Can response data from core reporting api be grouped?

Explanation:
I am able to query the Google Core reporting APIv3 using the client library to get data on pageviews for specific URLs of a website I am working on. I want to get data(pageviews) for each day within a specified range. So far I am simply looping through the range, sending individual request to the API. in each request I am setting the same value for the start date and the end date.
Problem:
Obviously this gets the job done, BUT it is certainly not the best way to go about it. Because, assumming I want to get data for the past 3 months for each of about 2000 URIs. Then I will need 360000 number of requests and that value is well over the limit quota defined by Google.
Potential solution: So one way I thought of solving this issue is probably to send a request setting start-date and end-date to be a week apart but the API will return a sum of the values rather than the individual values.
main question: So is there a way to insist that these values should not be added up and returned as a sum but rather returned (as associative array or something like that) separately for each.
I hope the question is clear and that there is a solution! Thank you!
Very straightforward:
Metric: ga:pageview, Dimension: ga:date, Set a filter for your pagepath, and set a start-date and end-date.
Example:
https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3Axxyyzz&dimensions=ga%3Adate&metrics=ga%3Apageviews&filters=ga%3Apagepath%3D%3D%2Ffaq.html&start-date=2013-06-27&end-date=2013-07-11&max-results=50
This will return the pageviews for that the faq.html& page for each day in the time-frame.
You should check out the QueryExplorer. Great tool to find out how to structure queries.