Can you POST a message to a topic that has been marked as a PUBLIC resource?

I tried to set the property ars_public to “true” for a topic and type using REST API, but I can’t call the target resource by its public URL (without using a Bearer Token).

Example :

a. I created a public topic as followings :

Method : PUT
URL: https://dev.vantiq.com/api/v1/resources/topics//public/topic

Request Body:
{
“ars_public” : true,
“description” : “topic”,
“isReliable” : false,
“name” : “/public/topic”
}

b. POST a message to the topic as followings :

Method:POST
URL:https://dev.vantiq.com/api/v1/resources/public/public_client_study/topics//public/topic

Request Body:
{
“temp”: 49,
“wind”: 2,
“barometer”: 990
}

c. Result :

HTTPStatus : 404 not found

Response Body:
{
“error”: “Resource not found: /api/v1/resources/public/public_client_study/topics//public/topic”
}

Posted: August 11, 2020 at 2:43 pm
Replies: 1
Aug 11, 2020
Posted by Ken

The only POST request you can make to a public resource is a POST on a procedure to execute that procedure. Otherwise, public access is limited to GET requests (selects) only.

You must be authenticated to publish to topics through the REST API. There is no support for public publishes to topics. This would pose a security problem, since events on those topics will trigger rules and event streams.

For more information on the restriction imposed on public clients, see the following section of the VANTIQ documentation: Public Client Restrictions

 

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
© Vantiq 2024 All rights reserved  •  Vantiq Corporation’s Privacy Policy and Cookie Policy