This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
SDK2 API

Web API

KyrcioKyrcio Member
edited April 13 in Developers
Is it possible to return something other than JSON by adding endpoints to the REST API? I was reading and experimenting with the api.js (https://apps.developer.athom.com/tutorial-Web Api.html), but whatever I return gets wrapped in a JSON object. In my case, I would like to return plain text, preferably with a custom content-type. Is this at all possible?
Tagged:

Comments

  • lubbertkramerlubbertkramer Member
    edited January 30
    Kyrcio said:
    Is it possible to return something other than JSON by adding endpoints to the REST API? I was reading and experimenting with the api.js (https://apps.developer.athom.com/tutorial-Web Api.html), but whatever I return gets wrapped in a JSON object. In my case, I would like to return plain text, preferably with a custom content-type. Is this at all possible?
    When you request it with your app/web app you can transform the JSON into anything you want offcourse but Athom will be giving access as described at the developers pages :) If you really would like to request a change  then you can always open up a request at the github of Athom
  • Guess you want one step further than this:
    https://github.com/athombv/homey/issues/1746

  • I suppose so, depending on how that was implemented. Normally REST uses HTTP status codes. It is strange to bake it into the response, but I guess there is a specific problem they are trying to solve.

    Maybe the web API is not supposed to be used to integrate with other HTTP-based devices? I could of course just open up another HTTP endpoint on another port, if that’s the way Athom intended it for apps.
Sign In or Register to comment.