Hi Community,
Due to a customer request, we noticed that a change in the SmartRest 1.0 API is planned:
Smart REST response codes
With the 10.9 GA release in April 2021, the error code “40” will be removed.
Why are we doing this? Currently, when connecting to Cumulocity IoT via SmartREST 1.0 you may receive an error “40”, often looking like this:
40,/meta/connect,402::Unknown client
86,0,handshake
This error means that the platform has restarted, the session has expired, or some other connectivity problem occurred. The number is misleading though, as according to the documentation “40” means “Template not found”.
After the error code “40” has been removed the error will look like this:
86,0,handshake
No change is required for devices integrated via our Device SDK and agents. However, be aware of this change, in case you have designed your own device integration.
I checked the official agent for C implementations on bitbucket and I wonder if it will still work with the changes planned for April. Can you confirm that the code will still work at this point:
bitbucket.org/m2m/cumulocity-sdk-c/src/master/src/srutils.cc
Line 69:
int registerSrTemplate(SrNetHttp &http, std::string &srv, const std::string &srt)
{
// send empty SmartREST request
if (http.post("") <= 0)
{
return -1;
}
// check server response
SrLexer lex(http.response());
SrLexer::SrToken t = lex.next();
if (t.second == "40")
{ // device implementation is unknown
http.clear();
// send SmartREST template for registration
if (http.post(srt) <= 0)
{
return -1;
}
// get response code
lex.reset(http.response());
t = lex.next();
}
if (t.second == "20")
{ // device implementation is known
// store "shorthand" id, can be used in X-ID header field of later requests
srv = lex.next().second;
return 0;
}
return -1;
}
Please let me know if there are changes in the agent necessary. If yes, will it be pushed to bitbucket?