access_via_api
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
access_via_api [2018/12/11 12:07] – [Getting current registers values] emozolyak | access_via_api [2019/06/07 14:27] – [Getting current registers values] akuzmuk | ||
---|---|---|---|
Line 883: | Line 883: | ||
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | In the request headers, you must pass the connection IDs (IDs). Register values will be returned only from those connections whose ID are specified in the X-WH-CONNS header. ID should be separated by comma, without spaces. This allows you to request not all registers, but only a part. | + | In the request headers, you must pass the connection IDs (IDs). Register values will be returned only from those connections whose ID are specified in the X-WH-CONNECTIONS |
Example: | Example: | ||
- | X-WH-CONNS: 1,2 | + | X-WH-CONNECTIONS: 1,2 |
| | ||
In this example, register values for the ID=1 and ID=2 will be returned. | In this example, register values for the ID=1 and ID=2 will be returned. | ||
Line 906: | Line 906: | ||
Accept-Encoding: | Accept-Encoding: | ||
X-WH-APIKEY: | X-WH-APIKEY: | ||
- | X-WH-CONNS: 1,2 | + | X-WH-CONNECTIONS: 1,2 |
| | ||
Example of the response: | Example of the response: | ||
Line 2107: | Line 2107: | ||
|**regid**| int |ID of the source register for value | | |**regid**| int |ID of the source register for value | | ||
+ | |||
+ | |||
+ | ===== Managing recipes list ===== | ||
+ | |||
+ | |||
+ | To get a list of all recipes, you must perform a GET request on the URL like this: http:// | ||
+ | |||
+ | To obtain information about a particular recipe, you must perform a following GET request on a URL ' | ||
+ | |||
+ | In the headers, it is necessary to pass API key. For example: | ||
+ | |||
+ | X-WH-APIKEY: | ||
+ | |||
+ | Also, in the headers, you must specify the desired data exchange format. Currently, only the JSON format is supported. | ||
+ | |||
+ | Accept: application/ | ||
+ | Content-Type: | ||
+ | |||
+ | Example of a query for all recipes data: | ||
+ | |||
+ | ***URL:** http:// | ||
+ | ***Method: | ||
+ | *Headers: | ||
+ | |||
+ | Accept: application/ | ||
+ | Content-Type: | ||
+ | Accept-Encoding: | ||
+ | X-WH-APIKEY: | ||
+ | |||
+ | Response example: | ||
+ | < | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | </ | ||
+ | |||
+ | ^Block attributes: | ||
+ | |**id**| int |Unique recipe identifier | | ||
+ | |**title**| string |Title of recipe | | ||
+ | |**category**| string |Category of recipe | | ||
+ | |**description**| string |Description of recipe | | ||
+ | |**regs_values**| string |List of register values in following format: reg_id1%%^%%new_value%%|%%reg_id2%%^%%new_value%%|%%reg_id3%%^%%new_value | | ||
+ | |**allowed_for_roles**| string |Comma-separated role IDs who can access this recipe | | ||
+ | |**disabled**| int |Flag that shows if recipe is disabled | | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | To update a register values in particular recipe it's necessary to execute PUT-request on URL http:// | ||
+ | |||
+ | In the headers, it is necessary to pass API key. For example: | ||
+ | |||
+ | X-WH-APIKEY: | ||
+ | |||
+ | Also, in the headers, you must specify the desired data exchange format. Currently, only the [[https:// | ||
+ | |||
+ | |||
+ | Accept: application/ | ||
+ | Content-Type: | ||
+ | |||
+ | |||
+ | In the request body, the json-object with at least of property be passed. | ||
+ | < | ||
+ | {" | ||
+ | </ | ||
+ | |||
+ | Example of updating title and register values to the recipe with ID = 5: | ||
+ | |||
+ | ***URL**: http:// | ||
+ | ***Method**: | ||
+ | *Headers: | ||
+ | |||
+ | Accept: application/ | ||
+ | Content-Type: | ||
+ | Accept-Encoding: | ||
+ | X-WH-APIKEY: | ||
+ | |||
+ | Request body: | ||
+ | |||
+ | {" | ||
+ | |||
+ | If the request is valid, API will return HTTP-code 200. | ||
access_via_api.txt · Last modified: 2023/03/02 10:53 by emozolyak