Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
OM2M/Subscription
Contents
Subscription resource
subscription resource is used to keep track of status of active subscription to its parent resource. A subscription represents a request from the Issuer to be notified about modifications on the parent resource.
Attribute Name | Type | Multiplicity | Create | Update | Response |
expirationTime | DateTime | 1 | O | O | M* |
minimalTimeBetweenNotifications | Long | 0..1 | O | O | O |
delayTolerance | DateTime | 0..1 | O | O | O |
creationTime | DateTime | 1 | NP | NP | M |
lastModifiedTime | DateTime | 1 | NP | NP | M |
filterCriteria | FilterCriteria | 0..1 | O | NP | O |
subscriptionType | SubscriptionType | 1 | NP | NP | M |
contact | AnyURI | 1 | M | NP | M |
id | NMTOKEN | 1 | O | NP | M* |
Subscription 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="subscription" type="tns:Subscription" /> <complexType name="Subscription"> <sequence> <element ref="tns:expirationTime" minOccurs="0" /> <element ref="tns:minimalTimeBetweenNotifications" minOccurs="0"/> <element ref="tns:delayTolerance" minOccurs="0" /> <element ref="tns:creationTime" minOccurs="0" /> <element ref="tns:lastModifiedTime" minOccurs="0" /> <element ref="tns:filterCriteria" minOccurs="0" /> <element ref="tns:subscriptionType" minOccurs="0" /> <element ref="tns:contact" minOccurs="0" /> <!-- sub-resources --> </sequence> <attribute ref="tns:id"/> </complexType> <element name="minimalTimeBetweenNotifications" type="long"> <annotation> <documentation> In milliseconds. </documentation> </annotation> </element> <element name="subscriptionType" type="tns:SubscriptionType" /> <element name="contact" type="anyURI" /> <simpleType name="SubscriptionType"> <restriction base="string"> <enumeration value="ASYNCHRONOUS" /> <enumeration value="SYNCHRONOUS" /> </restriction> </simpleType> </schema>
Create Subscription
Example Request
POST /scl-id/subscriptions Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx Body: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:subscription xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="SUB_1"> <om2m:contact>http://192.168.0.2:1300/AppServer</om2m:contact> </om2m:subscription>
Example Response
HTTP/1.1 201 Created Content-Type: text/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:subscription xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="SUB_1"> <om2m:expirationTime>2031-09-09T02:09:08.617Z</om2m:expirationTime> <om2m:creationTime>2014-04-01T00:22:29.622Z</om2m:creationTime> <om2m:lastModifiedTime>2014-04-01T00:22:29.625Z</om2m:lastModifiedTime> <om2m:subscriptionType>ASYNCHRONOUS</om2m:subscriptionType> <om2m:contact>http://192.168.0.2:1300/AppServer</om2m:contact> </om2m:subscription>
Retrieve Subscription
Example Request
GET /scl-id/subscriptions/SUB_1 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:subscription xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="SUB_1"> <om2m:expirationTime>2031-09-09T02:09:08.617Z</om2m:expirationTime> <om2m:creationTime>2014-04-01T00:22:29.622Z</om2m:creationTime> <om2m:lastModifiedTime>2014-04-01T00:22:29.625Z</om2m:lastModifiedTime> <om2m:subscriptionType>ASYNCHRONOUS</om2m:subscriptionType> <om2m:contact>http://192.168.0.2:1300/AppServer</om2m:contact> </om2m:subscription>
Update Subscription
Example Request
PUT /scl-id/subscriptions/SUB_1 Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx Body: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:subscription xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"> <om2m:expirationTime>2015-01-01T07:15:28.028Z</om2m:expirationTime> </om2m:subscription>
Example Response
HTTP/1.1 200 OK Content-Type: text/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <om2m:subscription xmlns:om2m="http://uri.etsi.org/m2m" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" om2m:id="SUB_1"> <om2m:expirationTime>2015-01-01T07:15:28.028Z</om2m:expirationTime> <om2m:creationTime>2014-04-01T00:22:29.622Z</om2m:creationTime> <om2m:lastModifiedTime>2014-04-01T00:22:54.727Z</om2m:lastModifiedTime> <om2m:subscriptionType>ASYNCHRONOUS</om2m:subscriptionType> <om2m:contact>http://192.168.0.2:1300/AppServer</om2m:contact> </om2m:subscription>
Delete Subscription
Example Request
DELETE /scl-id/subscriptions/SUB_1 Host: om2m.laas.fr Authorization: Basic xxxxxxxxxxxxxxxxxxx
Example Response
HTTP/1.1 204 No Content