• Image Management Service

ims
  1. Help Center
  2. Image Management Service
  3. Developer Guide
  4. Sharing an Image
  5. Updating the Image Sharing Status

Updating the Image Sharing Status

Scenario

The status of a shared image can be updated after the tenant accepts or rejects the image.

NOTE:

The token obtained from IAM is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequently calling the IAM API.

Involved APIs

If you use a token for authentication, you must obtain the token and add X-Auth-Token to the request header of the IMS API when making an API call.

  • IAM API used to obtain the token

    URI format: POST https://IAM endpoint/v3/auth/tokens

  • IMS API used to update the image sharing status (Native OpenStack API)

    URI format: UT /v2/images/{image_id}/members/{member_id}

Procedure

  1. Obtain the token by referring to Token Authentication.
  2. Send PUT https://IMS endpoint/v2/images/{image_id}/members/{member_id}member_id indicates the project ID of the image recipient.
  3. Add X-Auth-Token to the request header.
  4. Specify the following parameters in the request body:
    {
        "status":"accepted"//accepted indicates that the shared image will be accepted.
    }
  5. View the response parameters.
    {
        "status": "accepted",//Sharing status (accepted indicates that the shared image will be accepted.)
        "created_at": "2016-09-01T02:05:14Z",//Time when the image is shared
        "updated_at": "2016-09-01T02:37:11Z",//Time when the image is updated
        "image_id": "d164b5df-1bc3-4c3f-893e-3e471fd16e64",//Image ID
        "member_id": "edc89b490d7d4392898e19b2deb34797",//Member ID (that is, project ID of the image recipient)
        "schema": "/v2/schemas/member"//Image sharing schema
    }
  6. Refer to Status Code for details about the returned values if an abnormal value is returned.