Pergunta

I am attempting to write an api that interacts with an OpenStack cluster for a suite of tools and am looking into bulk-delete so I can avoid thousands of requests to the server.

According to my interpretation of the OpenStack documentation for bulk-delete I am doing the following:

  1. using a url similar to this one: http://ipaddress/v1/files/container-name?bulk-delete=true
  2. encoding my object names (which do exist):

    dps/filename.txt
    dps/filename1.txt
    dps/filename2.txt
    as
    dps%2Ffilename.txt%0Adps%2Ffilename1.txt%0Adps%2Ffilename2.txt

    and including them in the request body

  3. setting the content-type to text/plain in the headers
  4. sending in my auth token, of course, like always

After completing this request I get a 204 - No Content response which doesn't match the documentation for what response I should receive. Also, no files are deleted which is the real problem.

Any ideas for what I am doing wrong?

Foi útil?

Solução

The URI for sending the request should not include the name of the container.

Also, there are two problems with the request body you are sending.

  1. Do not encode the / character between the container name and the object name.
  2. Do not encode the newline characters.

The algorithm to produce the request body should actually go in this order:

  1. Encode the container names.
  2. Encode the object names.
  3. Create a line of text container/object using the encoded names from the previous steps.
  4. Create the request body by separating each of the lines from step 3 with a line feed character.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top