POST Datatype

Description

Creates a new committed datatype.

Requests

Syntax

POST /datatypes  HTTP/1.1
X-Hdf-domain: DOMAIN
Authorization: <authorization_string>
POST /datatypes?domain=DOMAIN  HTTP/1.1
Authorization: <authorization_string>

Request Parameters

This implementation of the operation does not use request parameters.

Request Headers

This implementation of the operation uses only the request headers that are common to most requests. See Common Request Headers

Request Elements

The request body must be a JSON object with a ‘type’ link key as described below. Optionally, the request body can include a ‘link’ key that describes how the new committed datatype will be linked.

type

The value of the type key can either be one of the predefined type strings (see predefined types), or a JSON representation of a type. (see Types).

Responses

Response Headers

This implementation of the operation uses only response headers that are common to most responses. See Common Response Headers.

Response Elements

On success, a JSON response will be returned with the following elements:

id

The UUID of the newly created datatype object.

root

The root group of the domain which the datatype is within.

attributeCount

The number of attributes belonging to the datatype.

created

A timestamp giving the time the datatype was created in UTC (ISO-8601 format).

lastModified

A timestamp giving the most recent time the datatype has been modified (i.e. attributes or links updated) in UTC (ISO-8601 format).

Special Errors

This implementation of the operation does not return special errors. For general information on standard error codes, see Common Error Responses.

Examples

Sample Request

Create a new committed datatype using the “H5T_IEEE_F32LE” (32-bit float) predefined type.

POST /datatypes HTTP/1.1
Host: hsdshdflab.hdfgroup.org
X-Hdf-domain: /shared/tall.h5
Content-Length: 26
Accept: */*
Accept-Encoding: gzip, deflate
{
    "type": "H5T_IEEE_F32LE"
}

Sample cURL command

$ curl -X POST -u username:password --header "X-Hdf-domain: /shared/tall.h5" --header "Content-Type: application/json"
  -d "{\"type\": \"H5T_IEEE_F32LE\"}" hsdshdflab.hdfgroup.org/datatypes

Sample Response

HTTP/1.1 201 Created
Date: Fri, 13 Jul 2018 15:35:49 GMT
Content-Length: 186
Content-Type: application/json
Server: nginx/1.15.0
{
    "id": "t-6b0bdf9a-86b2-11e8-89f2-0242ac120009",
    "created": 1531496149.3141127,
    "root": "g-b116b6f0-85e9-11e8-9cc2-0242ac120008",
    "lastModified": 1531496149.3141127,
    "attributeCount": 0
}

Sample cURL command

$ curl -X POST -u username:password --header "X-Hdf-domain: /shared/tall.h5" --header "Content-Type: application/json"
  -d "{\"type\": \"H5T_IEEE_F64LE\", \"link\": {\"id\": \"g-b116b6f0-85e9-11e8-9cc2-0242ac120008\", \"name\": \"linked_dtype\"}}" hsdshdflab.hdfgroup.org/datatypes