What is the format for the minTime URI parameter in the VSTS REST API, Builds - List? - azure-devops

Given a VSTS REST API call like this:
https://*account*/*project*/_apis/build/builds?definitions=2&minTime=????queryOrder=startTimeDescending&api-version=4.1
What is the correct datetime format for the minTime value? Everything I have tried either returns all builds, or none, and is not filtering by date. For example, I have tried "31/08/2018", "2018-08-31T12:01:31.450Z", "08/31/2018". The format is not documented anywhere that I can see.

The format for minTime should be YYYY-MM-DD.
So the request URL looks like:
https://marinaliu.visualstudio.com/Git2/_apis/build/builds?definitions=41&queryOrder=queueTimeDescending&minTime=2018-09-01&api-version=4.1
Note: when you specify minTime in the request url, it's not working to specify queryOrder with startTimeDescending. Instead, you can remove &queryOrder=startTimeDescending from url, or you can replace with queueTimeDescending.

&minTime=2022-04-18T00:00:00&maxTime=2022-04-19T23:59:00
This also worked for me with time component in addition to date component.

Related

Linkedin Ads API What's the format of the `dateRange` request parameter?

What's the right format for dateRange for rest-li v2?
The current examples in the documentation do not support it, and I don't understand from the rest-li documentation what's the format for it, exactly.
This is the request I make:
Headers:
X-Restli-Protocol-Version: 2.0.0
Authorization: Bearer <token-here>
URL (with request parameters):
https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=CAMPAIGN&dateRange.start.day=1&dateRange.start.month=1&dateRange.start.year=2017&timeGranularity=DAILY
OR
URL - deconstructed (with request parameters):
Base URL:https://api.linkedin.com/v2
Params:
q:analytics
pivot:CAMPAIGN
dateRange.start.day:1
dateRange.start.month:1
dateRange.start.year:2017
timeGranularity:DAILY
Error I get:
{
"serviceErrorCode": 100,
"message": "Unpermitted fields present in PARAMETER: Data Processing >Exception while processing fields [/dateRange.start.day, /dateRange.start.month, >/dateRange.start.year]",
"status": 403
}
Note: I'm referred to a question with the same error in the comments, however this might be caused by a different reason, and the answer there does not work for me. If by StackOverflow's standards you still think that it's a duplicate, please let me know and I'll close this question.
The first solution didn't work for me. As Linkedin's API documentation is shit in regards to this it took me a lot of trial and error. #Gal-Grünfeld final structure is correct but the example isn't. Linkedin's docs say the key is dateRange.start which is wrong.
dateRange=(start:(day:1,month:9,year:2020))
Solution provided by one of the LinkedIn developers:
For Restli version 2, for parameter dateRange (tested only for endpoint AnalyticsV2):
rangeDate := (start[,end]) (end is optional)
start, end - type: Date
Date := (day, month, year)
day - type: integer (tested for single digit only)
month - type: integer (tested for single digit only)
year - type: integer (tested for 4 digits only)
Final structure (not including the optional end):
dateRange=(start:(day:,month:,year:))
Example:
dateRange=(start:1,month:1,year:2017)
When you are using Python and requests, the working format of 'dateRange' parameter is:
params = {
'q': 'analytics',
'dateRange.start.day': '1',
'dateRange.start.month': '1',
'dateRange.start.year': '2022',
'pivot': 'COMPANY',
'timeGranularity': 'DAILY'
}
But remember to remove (or not use at all) the header "X-Restli-Protocol-Version"
Be careful about the query parameter encoding, I am using Faraday library for HTTP get requests and it encodes the query string, so I am correctly using the dateRange=(start:(day:1,month:9,year:2020)), but at the end Faraday encodes it to something like this: dateRange%3D%28start%3A%28day%3A1%2Cmonth%3A9%2Cyear%3A2020%29%29. But linkedin expects the first brackets unencoded, I had same problem with other endpoint, where the List(something) was not working, but with curl it was working, the difference is encoding.

How to append a prefix to a querystring parameter in AWS API Gateway?

When setting up URL Query String Parameters in the Integration Request part of an API method, it looks like I have the following options
reference a value from method.request.{path|querystring|header}.{var-name}
use a fixed single-quoted string
Even though API Gateway allows complex mappings on the body via VTL, it looks like querystring, header, and path variables do not have this option.
The specific use case I have is I want to populate the prefix query parameter for a call to S3's REST API with something like: 'read'+method.request.path.folder, so all GET requests start under a prefix (without the user having to specify that prefix).
Is there a way for me to achieve this goal using API Gateway?

Invalid_request_parameter (create and sending envelopes)

I'm trying to use a service of DocuSign API in an abap project. I want to send a document to a specific email so it can be signed. But im getting the following error:
"errorCode": "INVALID_REQUEST_PARAMETER",## "message": "The request contained at least one invalid parameter. Query parameter 'from_date' must be set to a valid DateTime, or 'envelope_ids' or 'transaction_ids' must be specified.
I tried the following:
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = l_url (https://demo.docusign.net/restapi/v2/accounts/XXXXXX')
proxy_host = co_proxy_host
proxy_service = co_proxy_service
IMPORTING
client = lo_http_client
lo_http_client->request->set_method( method = 'POST').
CALL METHOD lo_http_client->request->set_header_field
EXPORTING
name = 'Accept'
value = 'application/json'.
CALL METHOD lo_http_client->request->set_header_field
EXPORTING
name = 'X-DocuSign-Authentication'
value = get_auth_header( ). (json auth header)
CALL METHOD lo_http_client->request->set_cdata
EXPORTING
data = create_body( ).
This is my body:
CONCATENATE
`{`
`"emailSubject": "DocuSign REST API Quickstart Sample",`
`"emailBlurb": "Shows how to create and send an envelope from a document.",`
`"recipients": {`
`"signers": [{`
`"email": "test#email",`
`"name": "test",`
`"recipientId": "1",`
`"routingOrder": "1"`
`}]`
`},`
`"documents": [{`
`"documentId": "1",`
`"name": "test.pdf",`
`"documentBase64":` `"` l_encoded_doc `"`
`}],`
`"status": "sent"`
`}` INTO re_data.
The api request to get the Baseurl is working fine. (I know the error is quite specific what the problem is, but i cant find any sources on the docusign api documentation that one of the mentioned parameters should be added to the request)
Thank you in regards
The error message seems to indicate that you're Posting to an endpoint that requires certain query string parameters -- but you're not specifying them as expected in the query string. I'd suggest you check the DocuSign API documentation for the operation you are using, to determine what query string parameters it requires, and then ensure that you're including those parameters in your request URL.
If you can't figure this out using the documentation, then I'd suggest that you update your post to clarify exactly what URL (endpoint) you are using for the request, including any querystring parameters you're specifying in the URL. You can put fake values for things like Account ID, of course -- we just need to see the endpoint you are calling, and what qs params you're sending.
To create an envelope, use
https://demo.docusign.net/restapi/v2/accounts/XXXXXX/envelopes
instead of
https://demo.docusign.net/restapi/v2/accounts/XXXXXX
Thank you for all the answers, i found the mistake. Creating the request wasn´t the problem. I was using the wrong "sending"-method -_-.
now its working :)
lo_rest_client->post( EXPORTING io_entity = lo_request_entity ).

Why does one HTTP GET request retrieve the required data and another retrieve []

I'm currently working on ng-admin.
I'm having a problem retrieving user data from my REST API (connected to a MongoDB) and displaying it.
I have identified the problem as the following:
When I enter http://localhost:3000/users into my browser, I get a list of all users in my database.
When I enter http://localhost:3000/users?_page=1&_perPage=30&_sortDir=DESC&_sortField=id,
I get [] as a result.
I am quite new to this, I used both my browser and the POSTMAN Chrome extension to test this and get the same result.
http://localhost:3000/users_end=30&_order=DESC&_sort=id&_start=0
This (/users_end) is a different request than /users.
It should be:
http://localhost:3000/users?end=30&_order=DESC&_sort=id&_start=0
Or, by looking at the other parameters:
http://localhost:3000/users?_end=30&_order=DESC&_sort=id&_start=0
with end or _end being the first parameter (mark the ?).
Update (it is ? and before the _, I have edited.):
If adding parameters to the request returns an empty list, try adding only one at a time to narrow down the problem (there's probably an error in the usage of those parameters - are you sure you need those underscores?).
Your REST API must have a way to handle pagination, sorting, and filtering. But ng-admin cannot determine exactly how, because REST is a style and not a standard. So ng-admin makes assumptions about how your API does that by default, that's why it adds these _end and _sort query parameters.
In order to transform these parameters into those that your API understands, you'll have to add an interceptor. This is all thoroughly explained in the ng-admin documentation: http://ng-admin-book.marmelab.com/doc/API-mapping.html

How can I get multiple %-encoded parameters into an apiary URI template?

The ApiaryIO spec—actually the RFC to which it points—indicates that you cannot use "." in a parameter name, you need to encode it to "%2E". That's fine, but there seems to be a bug where Apiary can only handle one such encoding. For example, the following
## Notes Collection [/notes{?foo%2Ebar}]
yields the following Code Example
request = Request('http://private-d1ee7-testingnewapiary.apiary-mock.com/notes?foo.bar=foo.bar')
which is correct. However, the following
## Notes Collection [/notes{?foo%2Ebar,baz%2Ebla}]
yields this Code Example:
request = Request('http://private-d1ee7-testingnewapiary.apiary-mock.com/notes?foo%252Ebar=foo%252Ebar&baz%252Ebla=baz%252Ebla')
Notice how in the first the Code Example you see it has "foo.bar" but in the second example it has "foo%252Ebar", which is incorrect.
The downstream effect here is that the incorrect URI is sent to the API server so the response is malformatted creating an error.
How do I encode many "."-containing parameters on the URI template and still get the proper code examples?
Will adding explicit example values for those parameters help?
For example:
## Notes Collection [/notes{?foo%2Ebar,baz%2Ebla}]
+ Parameters
+ foo%2Ebar (`42`)
+ baz%2Ebla (`24`)
Update
This seems to be a bug in the way the documentation / code samples are rendered. I have created the tracking issue here https://github.com/apiaryio/language-templates/issues/36.