Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "OM2M/ContentInstance"
< OM2M
(→ContentInstance retrieve) |
(→ContentInstance representation) |
||
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
− | == | + | == ContentInstance resource == |
The contentInstance resource represents a data instance in the container. | The contentInstance resource represents a data instance in the container. | ||
Line 10: | Line 10: | ||
| Name || Type || Multiplicity || Create || Update ||Response | | Name || Type || Multiplicity || Create || Update ||Response | ||
|- | |- | ||
− | | [[OM2M/Attributes# | + | | [[OM2M/Attributes#ID|id]] || NMTOKEN || 1 || O || N/A || M* |
+ | |- | ||
+ | | [[OM2M/Attributes#Href|href]] || AnyURI || 1 || NP || N/A || O | ||
+ | |- | ||
+ | | [[OM2M/Attributes#ContentTypes|contentTypes]] || ContentTypes || 1 || O || N/A || O | ||
+ | |- | ||
+ | | [[OM2M/Attributes#ContentSize|contentSize]] || Long || 1 || NP || N/A || M | ||
+ | |- | ||
+ | | [[OM2M/Attributes#CreationTime|creationTime]] || DateTime || 1 || NP || N/A || M | ||
+ | |- | ||
+ | | [[OM2M/Attributes#LastModifiedTime|lastModifiedTime]] || DateTime || 1 || NP || N/A || M | ||
+ | |- | ||
+ | | [[OM2M/Attributes#DelayTolerance|delayTolerance]] || DateTime || 1 || O || N/A || M* | ||
+ | |- | ||
+ | | [[OM2M/Attributes#Content|content]] || Content || 1 || M || N/A || M | ||
|} | |} | ||
− | == | + | == ContentInstance XSD schema == |
<source lang="xml"> | <source lang="xml"> | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
Line 43: | Line 57: | ||
</source> | </source> | ||
− | == contentInstance | + | == Create ContentInstance == |
+ | '''Create a container' contentInstance resource''' | ||
+ | |||
+ | * Synopsis: POST {Well Known URI of the Service} | ||
+ | * Request Headers: Authorization, Accept. | ||
+ | * Request Body: M. | ||
+ | * Response Headers: Content-Type, Content-Length. | ||
+ | * Response Message Body: Application. | ||
+ | * Response Status: 201, 402, 404, 501. | ||
+ | |||
+ | '''Example Request''' | ||
+ | |||
+ | <pre> | ||
+ | POST /scl-id/containers/Id/contentInstances/ | ||
+ | Host: om2m.laas.fr | ||
+ | Authorization: Basic xxxxxxxxxxxxxxxxxxx | ||
+ | Body: | ||
+ | <obj> | ||
+ | <str name="type" val="Temperature_Sensor"/> | ||
+ | <str name="location" val="Home"/> | ||
+ | <str name="appId" val=app-Id/> | ||
+ | <op name="getValue" href="scl-id/applications/app-Id/containers/Id/contentInstances/latest/content" | ||
+ | in="obix:Nil" out="obix:Nil" is="retrieve"/> | ||
+ | </obj> | ||
+ | </pre> | ||
+ | |||
+ | '''Example Response''' | ||
+ | |||
+ | <pre> | ||
+ | HTTP/1.1 201 Created | ||
+ | Content-Type: text/xml | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
+ | <om2m:contentInstance xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="CI_650627555" href="scl-id/containers/Id/contentInstances/id"> | ||
+ | <om2m:creationTime>2014-04-17T21:04:20.985+02:00</om2m:creationTime> | ||
+ | <om2m:lastModifiedTime>2014-04-17T21:04:20.986+02:00</om2m:lastModifiedTime> | ||
+ | <om2m:delayTolerance>2014-04-18T00:24:20.985+02:00</om2m:delayTolerance> | ||
+ | <om2m:contentSize>288</om2m:contentSize> | ||
+ | <om2m:content xmime:contentType="application/xml">PG9iaj4gCiA8c3RyIG5hbWU9InR5cGUiIHZhbD0iVGVtcGVyYXR1cmVfU2Vuc29yIi8+IAogPHN0ciBuYW1lPSJsb2NhdGlvbiIgdmFsPSJIb21lIi8+IAogPHN0ciBuYW1lPSJhcHBJZCIgdmFs | ||
+ | PSJNWV9TRU5TT1IiLz4gCiA8b3AgbmFtZT0iZ2V0VmFsdWUiIGhyZWY9ImdzY2wvYXBwbGljYXRpb25zL01ZX1NFTlNPUi9jb250YWluZXJzL0RBVEEvY29udGVudEluc3RhbmNlcy9sYXRlc3QvY29udGVudCIgCmluPSJvYml4Ok5pbCIgb3V0PS | ||
+ | JvYml4Ok5pbCIgaXM9InJldHJpZXZlIi8+IAo8L29iaj4gCiAK</om2m:content> | ||
+ | </om2m:contentInstance> | ||
+ | </pre> | ||
+ | |||
+ | == Retrieve ContentInstance == | ||
+ | |||
+ | '''Retrieve information about contentInstance data value''' | ||
+ | |||
+ | * Synopsis: GET {Well Known URI of the Service} | ||
+ | * Request Headers: Authorization, Accept. | ||
+ | * Request Body: N/A. | ||
+ | * Response Headers: Content-Type, Content-Length. | ||
+ | * Response Message Body: Application. | ||
+ | * Response Status: 200, 402, 404, 501. | ||
+ | |||
+ | '''Example Request''' | ||
+ | |||
+ | <pre> | ||
+ | GET /scl-id/containers/Id/contentInstances/id | ||
+ | Host: om2m.laas.fr | ||
+ | Authorization: Basic xxxxxxxxxxxxxxxxxxx | ||
+ | </pre> | ||
+ | |||
+ | '''Example Response''' | ||
+ | |||
+ | <pre> | ||
+ | HTTP/1.1 200 OK | ||
+ | Content-Type: text/xml | ||
+ | |||
+ | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
+ | <om2m:contentInstance xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="CI_403186396" href="scl-id/containers/Id/contentInstances/id"> | ||
+ | <om2m:creationTime>2014-04-17T21:08:22.829+02:00</om2m:creationTime> | ||
+ | <om2m:lastModifiedTime>2014-04-17T21:08:22.829+02:00</om2m:lastModifiedTime> | ||
+ | <om2m:delayTolerance>2014-04-18T00:28:22.829+02:00</om2m:delayTolerance> | ||
+ | <om2m:contentSize>288</om2m:contentSize> | ||
+ | <om2m:content xmime:contentType="application/xml">PG9iaj4gCiA8c3RyIG5hbWU9InR5cGUiIHZhbD0iVGVtcGVyYXR1cmVfU2Vuc29yIi8+IAogPHN0ciBuYW1lPSJsb2NhdGlvbiIgdmFsPSJIb21lIi8+IAogPHN0ciBuYW1l | ||
+ | PSJhcHBJZCIgdmFsPSJNWV9TRU5TT1IiLz4gCiA8b3AgbmFtZT0iZ2V0VmFsdWUiIGhyZWY9ImdzY2wvYXBwbGljYXRpb25zL01ZX1NFTlNPUi9jb250YWluZXJzL0RBVEEvY29udGVudEluc3RhbmNlcy9sYXRlc3QvY29udGVudCIgCmluPSJvYml | ||
+ | 4Ok5pbCIgb3V0PSJvYml4Ok5pbCIgaXM9InJldHJpZXZlIi8+IAo8L29iaj4gCiAK</om2m:content> | ||
+ | </om2m:contentInstance> | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | == Update ContentInstance == | ||
+ | This operation is not allowed, the contentInstance resource cannot be modified once created. | ||
+ | |||
+ | == Delete ContentInstance == | ||
+ | |||
+ | '''Delete a contentInstance resource''' | ||
+ | |||
+ | * Synopsis: DELETE {Well Known URI of the Service} | ||
+ | * Request Headers: Authorization, Accept. | ||
+ | * Request Body: N/A. | ||
+ | * Response Headers: None. | ||
+ | * Response Message No content. | ||
+ | * Response Status: 204, 402, 404, 501. | ||
+ | |||
+ | '''Example Request''' | ||
− | + | <pre> | |
+ | DELETE /scl-id/containers/Id/contentInstances/id | ||
+ | Host: om2m.laas.fr | ||
+ | Authorization: Basic xxxxxxxxxxxxxxxxxxx | ||
+ | </pre> | ||
− | + | '''Example Response''' | |
− | + | <pre> | |
+ | HTTP/1.1 204 No Content | ||
+ | </pre> |
Latest revision as of 06:05, 4 May 2014
Contents
ContentInstance resource
The contentInstance resource represents a data instance in the container.
The contentInstance resource cannot be modified once created.
A contentInstance may be deleted explicitly or it may be deleted by the platform.
Name | Type | Multiplicity | Create | Update | Response |
id | NMTOKEN | 1 | O | N/A | M* |
href | AnyURI | 1 | NP | N/A | O |
contentTypes | ContentTypes | 1 | O | N/A | O |
contentSize | Long | 1 | NP | N/A | M |
creationTime | DateTime | 1 | NP | N/A | M |
lastModifiedTime | DateTime | 1 | NP | N/A | M |
delayTolerance | DateTime | 1 | O | N/A | M* |
content | Content | 1 | M | N/A | M |
ContentInstance XSD schema
<?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://uri.etsi.org/m2m" xmlns:tns="http://uri.etsi.org/m2m" xmlns:xmlmime="http://www.w3.org/2005/05/xmlmime"> <include schemaLocation="common.xsd" /> <import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="xmlmime.xsd" /> <element name="contentInstance" type="tns:ContentInstance" /> <complexType name="ContentInstance"> <all> <element ref="tns:creationTime" minOccurs="0" /> <element ref="tns:lastModifiedTime" minOccurs="0" /> <element ref="tns:delayTolerance" minOccurs="0" /> <element ref="tns:contentTypes" minOccurs="0" /> <element ref="tns:contentSize" minOccurs="0" /> <element ref="tns:content" minOccurs="0" /> </all> <attribute ref="tns:id" /> <attribute name="href" type="anyURI" /> </complexType> <element name="content" type="xmlmime:base64Binary" /> <element name="contentSize" type="long" /> <element name="contentTypes" type="tns:ContentTypes" /> <complexType name="ContentTypes"> <sequence> <element ref="tns:contentType" maxOccurs="unbounded" /> </sequence> </complexType> </schema>
Create ContentInstance
Create a container' contentInstance resource
- Synopsis: POST {Well Known URI of the Service}
- Request Headers: Authorization, Accept.
- Request Body: M.
- Response Headers: Content-Type, Content-Length.
- Response Message Body: Application.
- Response Status: 201, 402, 404, 501.
Example Request
POST /scl-id/containers/Id/contentInstances/ Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx Body: <obj> <str name="type" val="Temperature_Sensor"/> <str name="location" val="Home"/> <str name="appId" val=app-Id/> <op name="getValue" href="scl-id/applications/app-Id/containers/Id/contentInstances/latest/content" in="obix:Nil" out="obix:Nil" is="retrieve"/> </obj>
Example Response
HTTP/1.1 201 Created Content-Type: text/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:contentInstance xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="CI_650627555" href="scl-id/containers/Id/contentInstances/id"> <om2m:creationTime>2014-04-17T21:04:20.985+02:00</om2m:creationTime> <om2m:lastModifiedTime>2014-04-17T21:04:20.986+02:00</om2m:lastModifiedTime> <om2m:delayTolerance>2014-04-18T00:24:20.985+02:00</om2m:delayTolerance> <om2m:contentSize>288</om2m:contentSize> <om2m:content xmime:contentType="application/xml">PG9iaj4gCiA8c3RyIG5hbWU9InR5cGUiIHZhbD0iVGVtcGVyYXR1cmVfU2Vuc29yIi8+IAogPHN0ciBuYW1lPSJsb2NhdGlvbiIgdmFsPSJIb21lIi8+IAogPHN0ciBuYW1lPSJhcHBJZCIgdmFs PSJNWV9TRU5TT1IiLz4gCiA8b3AgbmFtZT0iZ2V0VmFsdWUiIGhyZWY9ImdzY2wvYXBwbGljYXRpb25zL01ZX1NFTlNPUi9jb250YWluZXJzL0RBVEEvY29udGVudEluc3RhbmNlcy9sYXRlc3QvY29udGVudCIgCmluPSJvYml4Ok5pbCIgb3V0PS JvYml4Ok5pbCIgaXM9InJldHJpZXZlIi8+IAo8L29iaj4gCiAK</om2m:content> </om2m:contentInstance>
Retrieve ContentInstance
Retrieve information about contentInstance data value
- Synopsis: GET {Well Known URI of the Service}
- Request Headers: Authorization, Accept.
- Request Body: N/A.
- Response Headers: Content-Type, Content-Length.
- Response Message Body: Application.
- Response Status: 200, 402, 404, 501.
Example Request
GET /scl-id/containers/Id/contentInstances/id Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx
Example Response
HTTP/1.1 200 OK Content-Type: text/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:contentInstance xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="CI_403186396" href="scl-id/containers/Id/contentInstances/id"> <om2m:creationTime>2014-04-17T21:08:22.829+02:00</om2m:creationTime> <om2m:lastModifiedTime>2014-04-17T21:08:22.829+02:00</om2m:lastModifiedTime> <om2m:delayTolerance>2014-04-18T00:28:22.829+02:00</om2m:delayTolerance> <om2m:contentSize>288</om2m:contentSize> <om2m:content xmime:contentType="application/xml">PG9iaj4gCiA8c3RyIG5hbWU9InR5cGUiIHZhbD0iVGVtcGVyYXR1cmVfU2Vuc29yIi8+IAogPHN0ciBuYW1lPSJsb2NhdGlvbiIgdmFsPSJIb21lIi8+IAogPHN0ciBuYW1l PSJhcHBJZCIgdmFsPSJNWV9TRU5TT1IiLz4gCiA8b3AgbmFtZT0iZ2V0VmFsdWUiIGhyZWY9ImdzY2wvYXBwbGljYXRpb25zL01ZX1NFTlNPUi9jb250YWluZXJzL0RBVEEvY29udGVudEluc3RhbmNlcy9sYXRlc3QvY29udGVudCIgCmluPSJvYml 4Ok5pbCIgb3V0PSJvYml4Ok5pbCIgaXM9InJldHJpZXZlIi8+IAo8L29iaj4gCiAK</om2m:content> </om2m:contentInstance>
Update ContentInstance
This operation is not allowed, the contentInstance resource cannot be modified once created.
Delete ContentInstance
Delete a contentInstance resource
- Synopsis: DELETE {Well Known URI of the Service}
- Request Headers: Authorization, Accept.
- Request Body: N/A.
- Response Headers: None.
- Response Message No content.
- Response Status: 204, 402, 404, 501.
Example Request
DELETE /scl-id/containers/Id/contentInstances/id Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx
Example Response
HTTP/1.1 204 No Content