You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Hono connection requires the connection ID to be set to the ID of the Hono tenant that this connection is to be used for.
But, when trying to create a Hono connection via the Connections HTTP API, along with specifying the connection ID in the request JSON, there is an error response:
{
"status": 400,
"error": "connectivity:id.notsettable",
"message": "It is not allowed to provide an explicit ID for a connection.",
"description": "Remove the ID from the connection as it will be generated."
}
Therefore it seems a Hono connection can't be created in the recommended way using the HTTP API. Instead, the piggyback commands API needs to be used.
The text was updated successfully, but these errors were encountered:
This should be possible using the PUT method and specifying the ID in the path.
But yes, same should also be possible using POST and id in payload.
That validation is outdated.
calohmn
changed the title
Can't create Hono connection via Connections HTTP API
Can't create Hono connection via Connections HTTP API POST
Sep 11, 2023
Update on this after looking into it: At least this is consistent for also creating things via POST and policies via POST.
So the current behaviour for all POST methods is:
an ID is automatically created by Ditto
if an ID is provided in the payload, a "Bad Request" is returned with the hint that setting the id for a newly created entity is not supported
the exception texts for creating policies and things are better as they mention the HTTP verb POST or e.g. mention: To provide your own Thing ID use a PUT request instead
One could now argue that we want to allow setting the entityId in the payload of the body - which would be ok for me. But I also don't have a strong need for that.
Ok. Then I think it would be good to add a note in the manage connections documentation about the possibility to use PUT /api/2/connections/my_id to create a connection (also adding the hint that the If-None-Match: * header can be used to ensure no update is done).
In the Hono-connection documentation page, this could be described as the way to create the connection.
A Hono connection requires the connection ID to be set to the ID of the Hono tenant that this connection is to be used for.
But, when trying to create a Hono connection via the Connections HTTP API, along with specifying the connection ID in the request JSON, there is an error response:
Therefore it seems a Hono connection can't be created in the recommended way using the HTTP API. Instead, the piggyback commands API needs to be used.
The text was updated successfully, but these errors were encountered: