Skip to content

Commit

Permalink
fixed incorrect put_attr
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Feb 5, 2015
1 parent a333b4f commit d4d04cf
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 28 deletions.
5 changes: 4 additions & 1 deletion docs/AttrOps/DELETE_Attribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ Syntax
------
.. code-block:: http
DELETE /groups/<id> HTTP/1.1
DELETE /groups/<id>/<name> HTTP/1.1
Host: DOMAIN
Authorization: <authorization_string>
* *<id>* is the UUID of the dataset/group/committed datatype
* *<name>* is the url-encoded name of the requested attribute

Request Parameters
------------------
This implementation of the operation does not use request parameters.
Expand Down
200 changes: 184 additions & 16 deletions docs/AttrOps/PUT_Attribute.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,43 @@ PUT Attribute

Description
===========
Creates a new Attribute.
Creates a new attribute in a group, dataset, or committed datatype.

*Note*: The new attribute will replace any existing attribute with the same name.

Requests
========

Syntax
------

To create a group attribute:

.. code-block:: http
PUT /groups/<id>/<name> HTTP/1.1
Host: DOMAIN
Authorization: <authorization_string>
To create a dataset attribute:

.. code-block:: http
DELETE /groups/<id> HTTP/1.1
PUT /datasets/<id>/<name> HTTP/1.1
Host: DOMAIN
Authorization: <authorization_string>
To create a committed datatype attribute:

.. code-block:: http
PUT /datatypes/<id>/<name> HTTP/1.1
Host: DOMAIN
Authorization: <authorization_string>
* *<id>* is the UUID of the dataset/group/committed datatype
* *<name>* is the url-encoded name of the requested attribute

Request Parameters
------------------
This implementation of the operation does not use request parameters.
Expand All @@ -26,6 +50,33 @@ Request Headers
This implementation of the operation uses only the request headers that are common
to most requests. See :doc:`../CommonRequestHeaders`

Request Elements
----------------

The request body must include a JSON object with "type" key. Optionally a "shape"
key can be provide to make a non-scalar attribute.


type
^^^^

Specify's the desired type of the attribute. Either a string that is one of the
predefined type values, a uuid of a committed type, or a JSON object describing the type.
See :doc:`../Types/index` for details of the type specification.

shape
^^^^^^

An integer array describing the initial dimensions of the attribute. If shape is not
provided, a scalar attribute will be created.

value
^^^^^

A JSON array (or number or string for scalar attributes with primitive types) that
specifies the initial values for the attribute. The elements of the array must be
compatible with the type of the attribute.

Responses
=========

Expand Down Expand Up @@ -53,37 +104,154 @@ information on standard error codes, see :doc:`../CommonErrorResponses`.
Examples
========

Sample Request
--------------
Sample Request - scalar attribute
----------------------------------

Create an integer scalar attribute in the group with UUID of "be319519-" named "attr4".
The value of the attribute will be 42.

.. code-block:: http
DELETE /groups/45a882e1-9d01-11e4-8acf-3c15c2da029e HTTP/1.1
Host: testGroupDelete.test.hdfgroup.org
Authorization: authorization_string
PUT /groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr4 HTTP/1.1
Content-Length: 38
User-Agent: python-requests/2.3.0 CPython/2.7.8 Darwin/14.0.0
host: tall_updated.test.hdfgroup.org
Accept: */*
Accept-Encoding: gzip, deflate
Sample Response
---------------
.. code-block:: json
{
"type": "H5T_STD_I32LE",
"value": 42
}
Sample Response - scalar attribute
-----------------------------------

.. code-block:: http
HTTP/1.1 201 Created
Date: Thu, 05 Feb 2015 06:25:30 GMT
Content-Length: 359
Content-Type: application/json
Server: TornadoServer/3.2.2
.. code-block:: json
{"hrefs": [
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr4", "rel": "self"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "owner"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "root"}
]
}
Sample Request - string attribute
----------------------------------

Create a two-element, fixed width string attribute in the group with UUID of
"be319519-" named "attr6".
The attributes values will be "Hello, ..." and "Goodbye!".

.. code-block:: http
HTTP/1.1 200 OK
Date: Thu, 15 Jan 2015 21:55:51 GMT
Content-Length: 270
PUT /groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr6 HTTP/1.1
Content-Length: 162
User-Agent: python-requests/2.3.0 CPython/2.7.8 Darwin/14.0.0
host: tall_updated.test.hdfgroup.org
Accept: */*
Accept-Encoding: gzip, deflate
.. code-block:: json
{
"shape": [2],
"type": {
"class": "H5T_STRING",
"cset": "H5T_CSET_ASCII",
"strpad": "H5T_STR_NULLPAD",
"strsize": 40
},
"value": ["Hello, I'm a fixed-width string!", "Goodbye!"]
}
Sample Response - string attribute
-----------------------------------

.. code-block:: http
HTTP/1.1 201 Created
Date: Thu, 05 Feb 2015 06:42:14 GMT
Content-Length: 359
Content-Type: application/json
Server: TornadoServer/3.2.2
.. code-block:: json
{
"hrefs": [
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr6", "rel": "self"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "owner"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "root"}
]
}
Sample Request - comound type
----------------------------------

Create a two-element, attribute of group with UUID of
"be319519-" named "attr_compound". The attribute has a compound type with an integer
and a floating point element.

.. code-block:: http
PUT /groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr_compound HTTP/1.1
Content-Length: 187
User-Agent: python-requests/2.3.0 CPython/2.7.8 Darwin/14.0.0
host: tall_updated.test.hdfgroup.org
Accept: */*
Accept-Encoding: gzip, deflate
.. code-block:: json
{
"shape": 2,
"type": {
"class": "H5T_COMPOUND",
"fields": [
{"type": "H5T_STD_I32LE", "name": "temp"},
{"type": "H5T_IEEE_F32LE", "name": "pressure"}
]
},
"value": [[55, 32.34], [59, 29.34]]
}
Sample Response - compound type
-----------------------------------

.. code-block:: http
HTTP/1.1 201 Created
Date: Thu, 05 Feb 2015 06:49:19 GMT
Content-Length: 367
Content-Type: application/json
Server: TornadoServer/3.2.2
.. code-block:: json
{
"hrefs": [
{"href": "http://testGroupDelete.test.hdfgroup.org/groups", "rel": "self"},
{"href": "http://testGroupDelete.test.hdfgroup.org/groups/45a06719-9d01-11e4-9b1c-3c15c2da029e", "rel": "root"},
{"href": "http://testGroupDelete.test.hdfgroup.org/", "rel": "home"}
]
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e/attributes/attr_compound", "rel": "self"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "owner"},
{"href": "http://tall_updated.test.hdfgroup.org/groups/be319519-acff-11e4-bf8e-3c15c2da029e", "rel": "root"}
]
}
Related Resources
=================

Expand Down
2 changes: 1 addition & 1 deletion docs/DatasetOps/GET_Dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The UUID of the dataset object.

type
^^^^
A JSON object representing the type of the dataset. See :doc:`GET_DatasetType` for
A JSON object representing the type of the dataset. See :doc:`../TypeOps/index` for
details of the type representation.

shape
Expand Down
3 changes: 1 addition & 2 deletions docs/DatasetOps/POST_Dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ Request Elements
The request body must include a JSON object with a "type" key. Optionally "shape",
"maxdims", and "link" keys can be provided.


type
^^^^
Either a string that is one of the predefined type values, a uuid of a committed type,
Expand Down Expand Up @@ -279,7 +278,7 @@ Sample Request - Committed Type
"shape": [10, 10]
}
Sample Response - Resizable Dataset
Sample Response - Committed Type
-----------------------------------

.. code-block:: http
Expand Down
6 changes: 3 additions & 3 deletions docs/DomainOps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Deleting Domains
Use :doc:`DELETE_Domain` to delete a domain. All resources within the domain will be
deleted!

Operations
----------
List of Operations
------------------

.. toctree::
:maxdepth: 2
:maxdepth: 1

DELETE_Domain
GET_Domain
Expand Down
11 changes: 6 additions & 5 deletions docs/GroupOps/POST_Group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Description
===========
Creates a new Group.

*Note:* The new Group will not be linked to any other group in the domain and a link
element is included in the request body.
If not including the link in the request, use the *PUT link* operation to link the new
group to another group.
*Note:* By default he new Group will not be linked from any other group in the domain.
A link element can be included in the request body to have an existing group link to
the new group.
Alternatively, use the *PUT link* operation to link the new
group.

Requests
========
Expand All @@ -33,7 +34,7 @@ to most requests. See :doc:`../CommonRequestHeaders`

Request Elements
----------------
Optionally the request body can be a JSON object that has a link key with subkeys:
Optionally the request body can be a JSON object that has a link key with sub-keys:

id
^^
Expand Down

0 comments on commit d4d04cf

Please sign in to comment.