Skip to content

JSON interface

mhhoeper edited this page Apr 2, 2021 · 11 revisions

JSON interface

This page describes the JSON interface for the RememberRecipe android app. The API's address is https://recipe.dns-cloud.net/new/<command>.

Command overview

The following commands are available:

Command Description
new_set Initialize new dataset and create session_id for further operations.
set_title Set title of recipe.
get_available_tags Get list of known tags. They could be used for auto-completion.
set_tags Set tags for recipe.
set_rating Set rating for recipe.
set_reference Set reference of recipe. E.g. book, page, ...
get_available_ingredients Get list of known ingredients. They could be used for auto-completion.
set_ingredients Set ingredients of recipe.
add_photo Add a photo for this recipe.
remove_photo Remove one of the saved photos.
move_photo Change order of photos.
read_back_data Read all data that is stored for the session_id including the photos.

new_set

Example URL https://recipe.dns-cloud.net/new/new_set
Status 200 Content-Type: application/json
HTTP request type: GET

new_set initializes a new data set. It is necessary to call this function before any other. It responds with a session_id that must be used for all other commands.

Function Call

No Attributes required.

Function Returns

The function returns the session_id.

Attribute Type Description
session_id integer The id for this session to use in further commands.

set_title

Example URL https://recipe.dns-cloud.net/new/set_title
Status 200 Content-Type: application/json
HTTP request type: POST

set_title saves the title for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
title string always The title for this recipe any

Function Return

Attribute Type Description
status string Returns ok if ok or error message

get_available_tags

Example URL https://recipe.dns-cloud.net/new/get_available_tags
Status 200 Content-Type: application/json
HTTP request type: GET

Get available tags to be used for auto-completion in the tags edit box.

Function Call

No parameters necessary

Function Return

Attribute Type Description
tags array of string Each array element is one tag

set_tags

Example URL https://recipe.dns-cloud.net/new/set_tags
Status 200 Content-Type: application/json
HTTP request type: POST

set_tags saves the tags for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
tags string always The tags in a single string any

Function Return

Attribute Type Description
status string Returns ok if ok or error message

set_rating

Example URL https://recipe.dns-cloud.net/new/set_rating
Status 200 Content-Type: application/json
HTTP request type: POST

set_rating saves the rating for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
rating integer always The rating for the recipe 0 to 5

Function Return

Attribute Type Description
status string Returns ok if ok or error message

set_reference

Example URL https://recipe.dns-cloud.net/new/set_reference
Status 200 Content-Type: application/json
HTTP request type: POST

set_reference saves the reference, i.e. cooking book, page, for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
reference string always The reference in a single string any

Function Return

Attribute Type Description
status string Returns ok if ok or error message

get_available_ingredients

Example URL https://recipe.dns-cloud.net/new/get_available_ingredients
Status 200 Content-Type: application/json
HTTP request type: GET

Get available ingredients to be used for auto-completion in the ingredients edit box.

Function Call

No parameters necessary

Function Return

Attribute Type Description
ingredients array of string Each array element is one known ingredient

set_ingredients

Example URL https://recipe.dns-cloud.net/new/set_ingredients
Status 200 Content-Type: application/json
HTTP request type: POST

set_ingredients saves the ingredients for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
ingredients string always The ingredients in a single string any

Function Return

Attribute Type Description
status string Returns ok if ok or error message

add_photo

Example URL https://recipe.dns-cloud.net/new/add_photo
Status 200 Content-Type: application/json
HTTP request type: POST

add_photo saves a photo for the recipe.

Function Call

Attribute Type Appears Description Possible Values
session_id integer always The id for this session returned by new_set The ID returned by new_set
photodata string always The binary photo data converted into base64. Only JPEG is supported at the moment any

Function Return

Attribute Type Description
status string Returns ok if ok or error message

remove_photo

TBD

move_photo

TBD

read_back_data

TBD