Search code examples
gethttp-status-code-400azure-batch

HTTP Get MissingRequiredQueryParameter


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?


Solution

  • 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.