Using CoAP for posting data to exosite server. What about IPv6?


#1

Hello,

I’m new to exosite and I have just created an account on portals.exosite.com. I would like to post some data to exosite server using CoAP protocol. The procedure I found looks like this:

POST: coap://coap.exosite.com/1a/alias?CIK
value
1.
I’ve tried to test it using Copper plugin, but I got 401 Unauthorized and I don’t know why, because as I understand CIK number is enough for authorization.
2.
Also I want to to ask if coap.exosite supports IPv6? And if does, the procedure for posting data is the same like above or the address should be different?

Best regards,
yoyki


#2

That request looks right as long at you’re replacing “alias” with and actual alias and “CIK” with the actual CIK of the client that owns that aliased data port.

coap://coap.exosite.com/1a/temp?6d18765178325a8b4ba2b4e35786ff5ba599f150 works for me in Copper.

I’m not sure why you’d be getting a 401, just make sure that you’ve copied the CIK correctly and if you’re using a device type other than “generic”, make sure that it has been activated (In the device information popup in portals you should see “Status: Activated”).

IPv6 works exactly the same way. If your computer has an IPv6 connection you may even already be using IPv6 when sending requests from Copper. If you want to force IPv6, you can use the domain coap6.exosite.com, but you should really only use that domain for testing.


#3

Hi Patrick,

I am able to write data using coap POST method but I get “4.04 Not Found” error code when I try to read data using GET.

For write data => POST coap://coap.exosite.com/1a/alias?CIK with payload = xxxx.
For read data => GET coap://coap.exosite.com/1a/alias?CIK. (Izzit correct?)


#4

@spider73

That looks correct, are you certain that you have input your alias name and CIK properly in your CoAP GET request?


#5

Hi Martin,

Thanks for your reply.

I’m using Firefox Copper and below are my test sequence:

  • I type in “coap://coap.exosite.com/1a/alias?CIK” onto the URL box.
  • I put new value into the Outgoing textbox.
  • I click on “POST” and I get “ACK” and my alias value changed accordingly.
  • I click on “GET” and I get “4.04 Not Found”.

Is there a different in URL box for POST and GET?


#6

Are you obfuscating the value of alias? It should be the alias of a dataport that the Client whose CIK you have owns.


#7

Hi Martin,

Let me provide an example:

alias = “temp” (current value = 24 degree celsius)
CIK = abcdef1234567890abcdef

URL = coap://coap.exosite.com/1a/temp?abcdef1234567890abcdef
New payload value = 18

When click POST, I got ACK. I check my exosite “temp” data value changed to 18 which is good.

Same URL, I click GET but I get 4.04 Not Found.


#8

Are you still sending a payload with your GET datagram?

I was able to replicate what you were seeing with Copper, but I chalked it up to my lack of a clue on how to use that tool.

I have been able to successfully read and write data using Python: https://github.com/exosite-garage/CoAPExample/blob/master/example_client_read.py


#9

Hi Martin,

Thanks for your reply!

I managed to GET successfully using Copper. Need to change the Block size behaviour to “Block late negotiation”.


#10

@spider73

That is great, I am glad to hear that you have things working.