Search code examples
apirestful-authenticationpostmanibm-cloud-infrastructureobject-storage

Unauthorized error while connecting Object Storage from API from Postman


I am trying to get object storage container details using provided API in post man But I am getting Unauthorized error,

API information available at http://developer.openstack.org/api-ref/object-storage/index.html?expanded=get-object-content-and-metadata-detail,show-account-details-and-list-containers-detail#accounts

Following details I am set in PostMan,

Method Get

Url: https://{domain}.objectstorage.softlayer.net/auth/v1.0/{userid}?format=json

Header: Key: X-Auth-Token Value: {token}

Error got in response of PostMan,

<html>
    <h1>Unauthorized</h1>
    <p>This server could not verify that you are authorized to access the document you requested.</p>
</html>

Solution

  • To retrieve containers from Object Storage using Postman, follow these steps:

    1. We need to generate the token to access Object Storage

    You need to get credentials from your object storage, so you can go to:

    Control Portal >> Object Storage >> Select Account Name (e.g. SLOS123123-10) >> Select Cluster (e.g. Milan 1) >> click on "View Credentials"

    You will be able to see

    • "Authentication Endpoint (public and private)"
    • "username"
    • "API Key (Password)"

    Then, you can go to postman and fill as the below example:

    enter image description here

    As you see, I had success with the request. So I need the "Headers" information from the response, as the follow example:

    enter image description here

    2. Retrieve containers

    After getting "X-Storage-Url" and "X-Storage-Token", you can retrieve the containers as the example below:

    enter image description here

    I hope it helps you to access Object Storage using Postman, please let me know any doubt or comment.