Warning: count(): Parameter must be an array or an object that implements Countable in /home/iteanz/public_html/wp-includes/post-template.php on line 317

4. Use the Swift API to manage containers and objects

In this section, you’ll run through some typical Swift API operations by using the Postman Chrome application.

  1. In Postman, click the + icon to open a new tab.
  2. Copy the url value that you saved in the previous section into the URL
  3. Append /mycontainer to the URL.
  4. Change the HTTP verb from GET to PUT to create a new container.
  5. Click Headers(0) and create a header with the label X-Auth-Token and value set to the value of the X-Subject-Token that you saved in the previous section.
  6. Click Send to verify that the returned Status is 201 Created.
  7. Change the HTTP verb from PUT to HEAD to get the metadata for the new container. Then, click Note that you are reusing the same header value from the previous request.
  8. Verify that the returned Status is 204 No Content and that several metadata values are in the returned HTTP header.
  9. Change the HTTP verb from HEAD to PUT to do an upload operation.
  10. Click the Body tab and then select binary.
  11. Click Choose File and select a file on your local system.
  12. Go back to the URL field and append /filename to the URL where filename is the name of the file that you selected. For example if you selected foo.txt, then you append /foo.txt to the URL.
  13. Click Send and verify that Status 201 Created is returned.
  14. Change the HTTP verb from PUT to GET so that you can send a list request for the container.
  15. Remove the file name suffix from the URL.
  16. Click Send and verify that the name of the file that you just uploaded is returned.
  17. Append ?format=json to the URL and send the GET request again. Verify that information about the file that you uploaded is returned in JSON format.
  18. Remove the ?format=json suffix from the URL and append /filename to the URL where filename is the name of the file that you uploaded earlier.
  19. Click Send and verify that the content of the file is returned and that the status is 200 OK.
  20. Optional: Before you remove the file and container, return to the Object Storage service management page and investigate the container and file that you added. Add more files or containers if you want.
  21. Change the HTTP verb from GET to DELETE to delete the file that you uploaded earlier.
  22. Click Send and verify that Status 204 No content is returned.
  23. Change the HTTP verb from DELETE to GET so that you can send a list request for the container.
  24. Remove the file name suffix from the URL.
  25. Click Send and verify that Status 204 No content is returned. Note that there is no content because the container has no files.