HTTP Get MissingRequiredQueryParameter - get

I am attempting to retrieve a file I have stored within a node within an Azure Batch pool. Passing a GET request using the URL:
https://ResourceName.southcentralus.batch.azure.com/jobs/adfv2-ResourceName/tasks/adaa9831-fca7-4562-8a7b-8aed60de151f/files/wd/filename.dat
Returns the error:
{
"odata.metadata":"https://ResourceName.southcentralus.batch.azure.com/$metadata#Microsoft.Azure.Batch.Protocol.Entities.Container.errors/#Element","code":"MissingRequiredQueryParameter","message":{
"lang":"en-US","value":"A query parameter that's mandatory for this request is not specified.\nRequestId:f72f00f7-1549-4dc4-b374-abaf3bd30b58\nTime:2018-05-18T13:59:17.0275742Z"
},"values":[
{
"key":"QueryParameterName","value":"api-version"
}
]
}
However, there is no indication as to the parameter to pass...
How can I retrieve the file?

The error response shows you what is needed in the request:
"values":[
{
"key":"QueryParameterName","value":"api-version"
}
]
An api-version is required on all requests. So for your example, try issuing a GET using:
https://ResourceName.southcentralus.batch.azure.com/jobs/adfv2-ResourceName/tasks/adaa9831-fca7-4562-8a7b-8aed60de151f/files/wd/filename.dat?api-version=2018-03-01.6.1
You can see the full REST API documentation for this action, which gives you an example.
For more information on available versions, see this doc.

Related

How to get file comments using Sharepoint rest api

I'm using the following api to successfully get file data:
https://acme.sharepoint.com/sites/my-site/_api/Web/Lists(guid'xxx')/files('yyy')
This is a docx file on which I've posted comments using the web console.
How can I fetch these comments using the rest api? I tried appending /comments to the url, but I'm getting the following 404 error:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException",
"message": {
"lang": "en-US",
"value": "Cannot find resource for the request Comments."
}
}
}
The Comments() endpoint currently exists only under the Items() endpoint and not under the Files() endpoint.
Basically, you can access the Comments() functionality only under the below endpoint:
GET https://{site_url}/_api/web/lists/GetByTitle({list_title})/items({item_id})/Comments
You can easily test the above in a PowerAutomate scenario with a Send Http Request to SharePoint actions.
In the below example I attempt to target the file in the document library:
On the other hand, if I attempt to target the file based on the List Item Id that it got in the document library I will get the below response:
As you can see from the above, I am also able to target a specific comment that I left.
Please take note of the below
The Comments() endpoint is not available for MS resources, meaning docx, excels and such files. It is only available for non-MS resource files like pdfs, txts and so on. I am not sure why this rule is in effect but, my best guess would be because there is a "commenting" functionality provided within a Word Document, for example.
You could find a bit more info about the above here.

Create and send an envelope from a template in docusign restapi v2.1 issue

I have created postman request to create and send envelop from template.
After sending it's returning this error
HTTP Error 400. The request URL is invalid.
Here is my postman request data
URL:https://demo.docusign.net/restapi/v2.1/accounts/xxxxxxxx/envelopes
Method: POST
Body:
{
"templateId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"templateRoles": [
{
"email":"test#gmail.com",
"name":"Tester",
"roleName":"signer3"
}
],
"status":"sent"
}
What can be the issue?
Here is the documentation link
I see nothing wrong above. You can see the full How to send an envelope with a template article.
Please confirm your accountId is correct where you have xxxxxxxx.
Please also see if you can use any URL for API calls.
A 400 error indicates there was something going on with the request. Can you turn on your API logging and see if you can reproduce the error? I agree with Inbar, I don't immediately see anything out of alignment. https://support.docusign.com/en/guides/ndse-user-guide-api-request-logging
If you could send the resulting log file along with a copy of your template to matt.king#docusign.com we can have a closer look.

How to disable NestJs Caching API responses

I have a normal NestJs application. I have a couple of APIs in it. Lately, I noticed that when I am testing them using Postman, the responses are being cached.
For eg.
I hit API-1 ... it gives me a response.
I hit API-2 ... it gives me the response plus the previous response.
Is there a tweak to disable this?
Thanks in advance.
This is API-1 which returns a normal response.
This is API-2 which returns the response of the previous API-1
#Controller({path: "product",scope: Scope.REQUEST})
I think this is the thing. Since node is single threaded it was not disposing my earlier instance and was using the same response variable over and over again. So my API-1 saved response to a variable called RESPONSE.
On the next request API-2 was using the same variable RESPONSE.
The RESPONSE variable structure was like this -
{
status: bool,
message: string,
data: object
}
API-1 modified it to
{
status: true,
message: "Done",
data: {"key":"value"}
}
However, API-2 was only using the first two keys.
{
status: true,
message: "Not done",
data: {"key":"value"}
}
And hence got the third data key of the previous request.
Ideally, this should not happen. But after applying the scope thing it got solved.
https://docs.nestjs.com/fundamentals/injection-scopes
Controllers can also have scope, which applies to all request method
handlers declared in that controller. Like provider scope, the scope
of a controller declares its lifetime. For a request-scoped
controller, a new instance is created for each inbound request, and
garbage-collected when the request has completed processing.

Azure Build Pipeline - Pause and Enable DefinitionQueueStatus change REST API

We have many dozens of build pipelines and we want to pause and resume (re-enable) build pipelines from a simple webapp interface as we are making config changes frequently. Here is the MS doc explaining this API:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/update%20build?view=azure-devops-rest-5.0#definitionqueuestatus
From this documentation, it appears I need to hit the REST API and change/toggle the DefinitionQueueStatus -- however, this documentation only shows a sample for a build specific operation, whereas I want to pause then re-enable the entire build pipeline. What is the proper way to make this call?
I'm using fetch - and I've tried many dozen formats in the call - the 'ourorg' and 'ourproject' are correct (we use this call structure for many other calls), but all fails for this call below. I grabbed the 'definitionID' from the URL I can visibly see when in the Azure devops portal on the specific build pipeline page, and I'm using it for the {buildID} as I don't know what else to put there. Any guidance to help here is appreciated - I don't need to use fetch btw - any working sample will help here:
fetch(https://dev.azure.com/our_org/our_projectname/_apis/build/builds/definitionId=1593?retry=true&api-version=5.0 {
method: 'PATCH ',
credentials: 'same-origin',
body: 'DefinitionQueueStatus: "Enabled"'
}).then(function(response) {
console.log(response);
})
It seems that the body is incorrect in your post. Here is sample about how to use POSTMAN to access Azure DevOps Services REST APIs.
Generate the PAT, and then record the token, it is important to use to authorization, please see this document.
Create a new request in POSTMAN, it is recommended to put the request in a collection for Azure DevOps Services REST API;
Select the authorization as Basic Auth, you can input the username as any value, and the password as the token which is generated in step1.
Basic Auth
Set the REST API which you want to use,and select the request method type(GET,POST,FETCH ....), here you use https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}?api-version=5.0.
In the Body tab, you can set the request body as raw in json format, and input the value as following:
{
"buildNumber":"#20190607.2",
"buildNumberRevision":1,
"definition":
{
"id":1,
"createdDate":null,
"queueStatus":"paused"
}
}
Everthing is ready now, you can send the request, if sccuess, you will get the response from the REST API.
In your post, the body content is incorrect, the Request Body should meet the format in the REST API document. The DefinitionQueueStatus is a type in definitions. In addition, if you send the request with parameter retry, you will get the message The request body must be empty when the retry parameter is specified..

Set Web properties of a site using SharePoint rest api

From Microsoft SharePoint documentation i can get web properties of a site using this request: "http:///_api/web/" (refer: https://msdn.microsoft.com/en-us/library/office/dn499819.aspx).
There are some properties which are R/W.
When i try to create these R/W properties i get 200 OK response but the properties value remain unchanged.
eg. property_name - SaveSiteAsTemplateEnabled.
initially it's value is True
initial get response:
{
"odata.metadata": "https://druvainternal.sharepoint.com/sites/testsharepoint/subsite1copy/_api/$metadata#Edm.Boolean",
"value": true
}
Then when i try to change its value using post call or merge call.
request:
"post"
endpoint - _api/web/SaveSiteAsTemplateEnabled
body = {"value":False}
The response i get is:
{"odata.metadata":"https://druvainternal.sharepoint.com/sites/testsharepoint/subsite1copy/_api/$metadata#Edm.Boolean","value":true
}
whose value is still True.
Am i sending the right request? In documentations it's not mentioned about how to set these properties.
Since Web.SaveSiteAsTemplateEnabled property is a property of Web class, you need to construct a request to update a Web resource for that matter.
The following example shows how to update SPWeb.SaveSiteAsTemplateEnabled property:
Endpoint Url: [web url]/api/web
Method: POST
Headers:
"X-HTTP-Method":"MERGE"
"If-Match":"*"
Data:
{"SaveSiteAsTemplateEnabled":false,"__metadata":{"type":"SP.Web"}}

Resources