Method | Mandatory | Supported in CoAP | LDP-CoAP Mapping | HTTP Response Code | CoAP Response Code |
---|---|---|---|---|---|
GET | YES | YES | GET | 200 OK | 2.05 Content |
POST | NO | YES | POST | 201 Created | 2.01 Created |
PUT | NO | YES | PUT | 204 No Content | 2.04 Changed |
DELETE | NO | YES | DELETE | 204 No Content | 2.02 Deleted |
PATCH | NO | NO | PUT ?ldp=patch | 204 No Content | 2.04 Changed |
HEAD | YES | NO | GET ?ldp=head | 204 No Content | 2.03 Valid |
OPTIONS | YES | NO | GET ?ldp=options | 204 No Content | 2.05 Content |
HTTP Header | LPD-CoAP Mapping |
---|---|
Content-Type | Content-Format (CT) CoAP option |
Link (rel="type") | Resource-Type (RT) Core Link format attribute, available through a CoAP discovery request |
Allow, Accept-Post, Accept-Patch | Not defined in CoAP, available in JSON format as body content of a LDP-CoAP Options request |
Slug | Title Core Link format attribute |
Location | Location-Path and Location-Query CoAP option |
HTTP Prefer Header | LPD-CoAP Mapping |
---|---|
Prefer: return=representation; include="pref" | ldp-incl=pref Core Link Format attribute |
Prefer:return=representation; omit="pref" | ldp-omit=pref Core Link Format attribute |
Preference-Applied: return=representation | pref returned using Location-Query CoAP option |
Content-Format codes used in the following examples: text/plain (ct=0), text/turtle (ct=4), application/rdf-patch (ct=53)
</.well-known/core>,
</ldp-rs>
rt="http://www.w3.org/ns/ldp#RDFSource http://www.w3.org/ns/ldp#Resource";
ct=4; title="ldp-rs",
</ldp-nr>
rt="http://www.w3.org/ns/ldp#NonRDFSource http://www.w3.org/ns/ldp#Resource";
ct=0; title="ldp-nr",
</ldp-bc>
rt="http://www.w3.org/ns/ldp#BasicContainer http://www.w3.org/ns/ldp#Container http://www.w3.org/ns/ldp#Resource";
ct=4; title="ldp-bc",
</ldp-dc>
rt="http://www.w3.org/ns/ldp#DirectContainer http://www.w3.org/ns/ldp#Container http://www.w3.org/ns/ldp#Resource";
ct=4; title="ldp-dc",
</ldp-dc/tmp35>
rt="http://purl.oclc.org/NET/ssnx/ssn#SensingDevice http://www.w3.org/ns/ldp#Resource";
ct=4; title="Temperature Sensor TMP35",
</ldp-dc/tmp35/obs1>
rt="http://purl.oclc.org/NET/ssnx/ssn#Observation http://www.w3.org/ns/ldp#Resource";
ct=4; title="Observation"
GET /alice/ HTTP/1.1
Host: example.org
Accept: text/turtle
HTTP/1.1 200 OK
Content-Type: text/turtle; charset=UTF-8
Link: <http://www.w3.org/ns/ldp#BasicContainer> rel="type",
<http://www.w3.org/ns/ldp#Resource> rel="type"
Allow: OPTIONS,HEAD,GET,POST,PUT,PATCH
Accept-Post: text/turtle, application/ld+json, image/bmp, image/jpeg
Accept-Patch: text/ldpatch
Content-Length: 250
ETag: W/'123456789'
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
<http://example.org/alice/> a ldp:Container, ldp:BasicContainer;
dcterms:title "Alice's data storage on the Web" .
GET coap://example.org/alice/
Accept: text/turtle
2.05 Content
Content-Format (ct): text/turtle
ETag: W/'123456789'
@prefix dcterms: <http://purl.org/dc/terms/>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
<http://example.org/alice/> a ldp:Container, ldp:BasicContainer;
dcterms:title "Alice's data storage on the Web" .
POST /alice/ HTTP/1.1
Host: example.org
Slug: foaf
Content-Type: text/turtle
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a foaf:PersonalProfileDocument;
foaf:primaryTopic <#me> ;
dc:title "Alice's FOAF file" .
<#me> a foaf:Person;
foaf:name "Alice Smith" .
HTTP/1.1 201 Created
Location: http://example.org/alice/foaf
Link: <http://www.w3.org/ns/ldp#Resource> rel='type'
Content-Length: 0
POST coap://example.org/alice?title=foaf
Content-Format (ct): text/turtle
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a foaf:PersonalProfileDocument;
foaf:primaryTopic <#me> ;
dc:title "Alice's FOAF file" .
<#me> a foaf:Person;
foaf:name "Alice Smith" .
2.01 Created
Location-Path: coap://example.org/alice/foaf
PUT /alice/foaf HTTP/1.1
Host: example.org
If-Match: W/"123454321"
Content-Type: text/turtle
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a foaf:PersonalProfileDocument;
foaf:primaryTopic <#me> ;
dc:title "Alice's FOAF file" .
<#me> a foaf:Person;
foaf:name "Alice Smith" ;
foaf:img <http://example.org/alice/avatar> .
HTTP/1.1 204 No Content
Link: <http://www.w3.org/ns/ldp#Resource> rel="type"
PUT coap://example.org/alice/foaf
If-Match: W/"123454321"
Content-Format (ct): text/turtle
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a foaf:PersonalProfileDocument;
foaf:primaryTopic <#me> ;
dc:title "Alice's FOAF file" .
<#me> a foaf:Person;
foaf:name "Alice Smith" ;
foaf:img <http://example.org/alice/avatar> .
2.04 Changed
DELETE /alice/avatar HTTP/1.1
Host: example.org
HTTP/1.1 204 No Content
DELETE coap://example.org/alice/avatar
2.02 Deleted
OPTIONS /alice HTTP/1.1
Host: example.org
HTTP/1.1 204 No Content
Allow: OPTIONS,HEAD,GET,POST,PUT,PATCH
Accept-Post: text/turtle, application/ld+json, image/bmp, image/jpeg
Accept-Patch: text/ldpatch
Link: <http://www.w3.org/ns/ldp#BasicContainer> rel="type",
<http://www.w3.org/ns/ldp#Resource> rel="type"
GET coap://example.org/alice?ldp=options
2.05 Content
Content-Format (ct): application/json
{
"Allow": ["OPTIONS", "HEAD", "GET", "POST", "PUT", "PATCH"],
"Accept-Post": [ "text/turtle", "application/ld+json",
"image/bmp", "image/jpeg"],
"Accept-Patch": "text/ldpatch"
}
OPTIONS /alice HTTP/1.1
Host: example.org
HTTP/1.1 204 No Content
Allow: OPTIONS,HEAD,GET,POST,PUT,PATCH
Link: <http://www.w3.org/ns/ldp#BasicContainer> rel="type",
<http://www.w3.org/ns/ldp#Resource> rel="type"
ETag: W/'123456789'
Content-Type: text/turtle
GET coap://example.org/alice?ldp=head
2.03 Valid
Content-Format (ct): text/turtle
ETag: W/'123456789'
PATCH /bob HTTP/1.1
Host: example.org
Content-Type: application/rdf-patch
If-Match: W/"123454321"
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
A <> foaf:knows <http://example.org/alice> .
HTTP/1.1 204 No Content
Link: <http://www.w3.org/ns/ldp#Resource> rel="type"
PUT coap://example.org/bob?ldp=patch
If-Match: W/"123454321"
Content-Format (ct): application/rdf-patch
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
A <> foaf:knows <http://example.org/alice> .
2.04 Changed