I am trying to implement oneM2M standard. I looked at the application developer guide at http://www.onem2m.org/application-developer-guide/application-registration
ADN-AE-1 sending a registration request to MN-CSE but the request payload contains an ACPI and I dont understand how ADN-AE-1 knows that ACPI ?
POST /home_gateway?rcn=0 HTTP/1.1
Host: mn.provider.com:8080
X-M2M-Origin: C
Content-Type: application/vnd.onem2m-res+json; ty=2
X-M2M-RI: mncse-92345
{ "m2m:ae": {
"rn": "light_ae1",
"api": "A01.com.company.lightApp01",
"rr": "true",
"poa": ["http://192.168.0.10:9090"],
"acpi": ["/mn-cse/acp-805496226"]
}
}
You have basically two choices.
First, you can just leave out the acpi in your request. In this case the CSE automatically assigns one (a default ACP resource) to the new AE. You will then get the acpi for that assign in the answer to the create request.
But this is perhaps not what you want, because you might end up with an assign ACP that would not reflect the actually permissions you need.
The second method is that you create the ACP for the AE yourself. This is done very similar to creating an AE resource, just with the ACP structure. The CSE is responsible to check, whether you specified everything correctly and within the allowed permission range. In the answer you get the resource identifier (ri) for the new ACP resource, which you then would assign to the acpi attribute when you create the AE resource.
With the second method, it is a good practice to look for the ACP resource first, because it might already exist (either created by the AE as described above during a previous run of your application, or even pre-defined by, for example, the CSE admin), so you could just retrieve it instead of creating it.
You should use the structured name instead of the ri to access a known resource, e.g. a pre-defined ACP. For example, you would try to access a resource on a CSE with the structured name /cse-id/cse-name/myACP
instead of the resource identifier /cse-id/acp-12345
. This method requires you to construct the structured name, which is a bit longer, but has the advantage that it reflects the resource structure and makes the resources accessible by the path through the resource tree, while the resource identifier is very short, but does not reflect the resource structure.