question

David-2622 avatar image
0 Votes"
David-2622 asked SumanthMarigowda-MSFT commented

Azure Blob Starage - Rest API - 400 One of the request inputs is not valid

I am trying to delete a blob from an Azure Blob Storage with a batch request.
At the moment I am using postman to verify my request before I use it in my application.
I cannot manage to get a different output or error. For authorization I use SAS.

Here is my request:
Url:

 https://APPLICATIONNAME.blob.core.windows.net/MYCONTAINER?restype=container&comp=batch&sig=SIGNATURE&sp=racwdl&sip=92.60.9.18&sv=2020-08-04&st=2022-04-27T08:52:29Z&spr=https&se=2022-05-30T16:52:29Z&sr=c

Headers:

 Content-Type: multipart/mixed; boundary=batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
 x-ms-version: 2020-08-04

Body:

 --batch_357de4f7-6d0b-4e02-8cd2-6361411a9525
 Content-Type: application/http
 Content-Transfer-Encoding: binary
 Content-ID: 0
    
 DELETE /MYCONTAINER/NAVIGATIONS.sql?sp=racwdl&sig=SIGNATURE&sip=92.60.9.18&sv=2020-08-04&st=2022-04-27T08:52:29Z&spr=https&se=2022-05-30T16:52:29Z&sr=c HTTP/1.1
 Content-Length: 0
    
 --batch_357de4f7-6d0b-4e02-8cd2-6361411a9525--

Response:

 --batchresponse_cdb19852-af76-4719-b9d2-8d61b5d3e6da
 Content-Type: application/http
    
 HTTP/1.1 400 One of the request inputs is not valid.
 x-ms-error-code: InvalidInput
 x-ms-request-id: 4dd49405-d01e-0035-12c4-601f12000000
 x-ms-version: 2020-08-04
 Content-Length: 221
 Content-Type: application/xml
 Server: Windows-Azure-Blob/1.0
    
 <?xml version="1.0" encoding="utf-8"?>
 <Error><Code>InvalidInput</Code><Message>One of the request inputs is not valid.
 RequestId:4dd49405-d01e-0035-12c4-601f12000000
 Time:2022-05-05T21:07:45.5349988Z</Message></Error>
 --batchresponse_cdb19852-af76-4719-b9d2-8d61b5d3e6da--

I hope someone can give me a hint or solution.

azure-blob-storage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SumanthMarigowda-MSFT avatar image
0 Votes"
SumanthMarigowda-MSFT answered

@David-2622 Welcome to Microsoft Q&A Forum, Thank you for posting your query here! Firstly, apologies for the delay in responding here and any inconvenience this issue may have caused.

I was able to repro the issue, please refer to the below mentioned samples

using System;
using Azure.Storage;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Specialized;
using Azure.Storage.Blobs.Models;
using System.Collections.Generic;



namespace BatchDelete

{
class Program
{
static void Main(string[] args)
{
//List<String> Uri;
string connectionString = "connectionString";
BlobServiceClient serviceClient = new BlobServiceClient(connectionString);



// Get URIs for a couple of existing blobs
Uri a = serviceClient.GetBlobContainerClient("containerName").GetBlobClient("blobName").Uri;
Uri b = serviceClient.GetBlobContainerClient("test2").GetBlobClient("b.txt").Uri;
Uri c = serviceClient.GetBlobContainerClient("test2").GetBlobClient("c.txt").Uri;



// Create a batch client
BlobBatchClient batchClient = serviceClient.GetBlobBatchClient();



// Delete several blobs in one batched request
batchClient.DeleteBlobs(new Uri[] { a, b, c });
}
}
}

Please let us know if you have any further queries. I’m happy to assist you further.


Please do not forget to 201755-screenshot-2021-12-10-121802.png and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.



5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

David-2622 avatar image
0 Votes"
David-2622 answered SumanthMarigowda-MSFT commented

Hi @Sumarigo-MSFT
This code doesnt help me since i use the rest api directly. We use Xquery/Marklogic to make the request. To debug it i used Postman.
Do you see an issue with the request in the post above?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.