Curl examples from the Image API v2 document should go in User Guide

Bug #1399814 reported by Anne Gentle
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openstack-manuals
Fix Released
Medium
Sharat Sharma

Bug Description

Appendix A: cURL Examples
=========================

This section is intended to provide a series of commands a typical
client of the API might use to create and modify an image.

These commands assume the implementation of the v2 Images API is using
the OpenStack Identity Service for authentication and authorization. The
X-Auth-Token header is used to communicate the authentication token
provided by that separate identity service.

The strings ``$OS_IMAGE_URL`` and ``$OS_AUTH_TOKEN`` represent variables
defined in the client's environment. ``$OS_IMAGE_URL`` is the full path
to your image service endpoint, for example, ``http://localhost:9292``.
``$OS_AUTH_TOKEN`` represents an auth token generated by the OpenStack
Identity Service, for example, ``6583fb17c27b48b4b4a6033fe9cc0fe0``.

Create an Image
---------------

::

    % curl -i -X POST -H "X-Auth-Token: $OS_AUTH_TOKEN" \
           -H "Content-Type: application/json" \
           -d '{"name": "Ubuntu 12.10", "tags": ["ubuntu", "12.10", "quantal"]}' \
           $OS_IMAGE_URL/v2/images

::

    HTTP/1.1 201 Created
    Content-Length: 451
    Content-Type: application/json; charset=UTF-8
    Location: http://localhost:9292/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad
    Date: Tue, 14 Aug 2012 00:46:48 GMT

    {
        "id": "7b97f37c-899d-44e8-aaa0-543edbc4eaad",
        "name": "Ubuntu 12.10",
        "status": "queued",
        "visibility": "private",
        "protected": false,
        "tags": ["ubuntu", "12.10", "quantal"],
        "created_at": "2012-08-14T00:46:48Z",
        "updated_at": "2012-08-14T00:46:48Z",
        "file": "/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad/file",
        "self": "/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad",
        "schema": "/v2/schemas/image"
    }

Update the Image
----------------

::

    % curl -i -X PATCH -H "X-Auth-Token: $OS_AUTH_TOKEN" \
           -H "Content-Type: application/openstack-images-v2.1-json-patch"
           -d '[{"op": "add", "path": "/login-user", "value": "root"}]' \
           $OS_IMAGE_URL/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad

::

    HTTP/1.1 200 OK
    Content-Length: 477
    Content-Type: application/json; charset=UTF-8
    Date: Fri, 15 Nov 2013 00:46:50 GMT

    {
        "id": "7b97f37c-899d-44e8-aaa0-543edbc4eaad",
        "name": "Ubuntu 12.10",
        "status": "queued",
        "visibility": "private",
        "protected": false,
        "tags": ["ubuntu", "12.10", "quantal"],
        "login_user": "root",
        "created_at": "2013-11-15T00:46:48Z",
        "updated_at": "2013-11-15T00:46:50Z",
        "file": "/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad/file",
        "self": "/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad",
        "schema": "/v2/schemas/image"
    }

Upload Binary Image Data
------------------------

::

    % curl -i -X PUT -H "X-Auth-Token: $OS_AUTH_TOKEN" \
           -H "Content-Type: application/octet-stream" \
           -d @/home/glance/ubuntu-12.10.qcow2 \
           $OS_IMAGE_URL/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad/file

::

    HTTP/1.1 100 Continue

    HTTP/1.1 201 Created
    Content-Length: 0
    Date: Tue, 14 Aug 2012 00:46:59 GMT

Download Binary Image Data
--------------------------

::

    % curl -i -X GET -H "X-Auth-Token: $OS_AUTH_TOKEN" \
           $OS_IMAGE_URL/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad/file

::

    HTTP/1.1 200 OK
    Content-Type: application/octet-stream
    Content-Md5: 912ec803b2ce49e4a541068d495ab570
    Transfer-Encoding: chunked
    Date: Thu, 14 Aug 2012 00:47:10 GMT

Delete Image
------------

::

    % curl -i -X DELETE -H "X-Auth-Token: $OS_AUTH_TOKEN" \
           $OS_IMAGE_URL/v2/images/7b97f37c-899d-44e8-aaa0-543edbc4eaad

::

    HTTP/1.1 204 No Content
    Content-Length: 0
    Date: Tue, 14 Aug 2012 00:47:12 GMT

Tags: user-guide
Tom Fifield (fifieldt)
Changed in openstack-manuals:
milestone: none → kilo
status: New → Triaged
importance: Undecided → Medium
tags: added: user-guide
Tom Fifield (fifieldt)
Changed in openstack-manuals:
milestone: kilo → liberty
Changed in openstack-manuals:
assignee: nobody → jelly (coding1314)
Changed in openstack-manuals:
assignee: jelly (coding1314) → inwinSTACK (inwinstack)
Rico Lin (rico-lin)
Changed in openstack-manuals:
assignee: inwinSTACK (inwinstack) → nobody
Revision history for this message
Njira Perci (njirap) wrote :

Hi Tom and Anne.. Is the bug description supposed to be copy pasted as in to the user-guide..?

Revision history for this message
Anne Gentle (annegentle) wrote :

Yes, if it is tested and still works. There's lots of confusion about the glance calls lately so it would be nice to clear it up.

We brought in curl examples for the Object Storage API, here are some examples: http://docs.openstack.org/user-guide/cli_swift_large_lists.html
http://docs.openstack.org/user-guide/cli_swift_pseudo_hierarchical_folders_directories.html

so try to find a good place for these create/update/upload/delete tasks.

Sai Kiran (saikiran)
Changed in openstack-manuals:
assignee: nobody → Sai Kiran (saikiran)
Changed in openstack-manuals:
milestone: liberty → mitaka
Changed in openstack-manuals:
assignee: Sai Kiran (saikiran) → Sharat Sharma (sharat-sharma)
Changed in openstack-manuals:
status: Triaged → Confirmed
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-manuals (master)

Fix proposed to branch: master
Review: https://review.openstack.org/291705

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/292361

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-manuals (master)

Change abandoned by Sharat Sharma (<email address hidden>) on branch: master
Review: https://review.openstack.org/292361
Reason: Abondoning as change not significant.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-manuals (master)

Fix proposed to branch: master
Review: https://review.openstack.org/292711

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-manuals (master)

Change abandoned by Sharat Sharma (<email address hidden>) on branch: master
Review: https://review.openstack.org/292711
Reason: Duplicate

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-manuals (master)

Fix proposed to branch: master
Review: https://review.openstack.org/298211

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: master
Review: https://review.openstack.org/298633

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on openstack-manuals (master)

Change abandoned by Sharat Sharma (<email address hidden>) on branch: master
Review: https://review.openstack.org/298211

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Sharat Sharma (<email address hidden>) on branch: master
Review: https://review.openstack.org/291705
Reason: https://review.openstack.org/#/c/298633/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-manuals (master)

Reviewed: https://review.openstack.org/298633
Committed: https://git.openstack.org/cgit/openstack/openstack-manuals/commit/?id=bc4d9ddb1ec92b2da37fa86da3667bb15245b974
Submitter: Jenkins
Branch: master

commit bc4d9ddb1ec92b2da37fa86da3667bb15245b974
Author: sharat.sharma <email address hidden>
Date: Tue Mar 29 15:26:32 2016 +0530

    [user-guide] Added cURL examples to manage images from cli.

    Change-Id: I00d76586f083cd8c131e3264558148f641cdb75f
    Closes-Bug: #1399814

Changed in openstack-manuals:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-manuals 15.0.0

This issue was fixed in the openstack/openstack-manuals 15.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.