{% blocktranslate trimmed %} Galería includes a very simple API REST to query and modify the online gallery; in general, querying operations do not require authentication; while all the oprations that modify the gallery does, using the user token in Django, which is automatically shown in the Information entry of the menu. {% endblocktranslate %}
{% translate "List albums" %}
{% blocktranslate trimmed %} Retuns a list of all the albums and their properties in the gallery, in JSON format. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: list_albums
- Parameters: None
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/list_albums
{% translate "List photographs" %}
{% blocktranslate trimmed %} Retuns a list of all the photos and their properties in the gallery, in JSON format. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: list_photos
- Parameters: None
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/list_photos
{% translate "Random photograph" %}
{% blocktranslate trimmed %} Returns enough information of a random photo in the gallery so it can be shown in another site. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: random_photo
- Parameters: None
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/random_photo
{% translate "Upload photographs" %}
{% blocktranslate trimmed %} Uploads one or more photographs to the gallery. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: upload_photos
- Parameters: One or multiples files in the fields field of a POST form
- Authentication: Yes
- Use:
{% endblocktranslate %}
# Subir una imagen curl -H 'Authorization: Token {{token}}' \ -X POST -F "files=@image.jpg" \ {{galeria_url}}/rest/upload_photo
# Subir múltiples imágenes curl -H 'Authorization: Token {{token}}' \ -X POST -F "files=@image1.jpg" -F "files=@image2.jpg" ... \ {{galeria_url}}/rest/upload_photos
{% translate "Delete item" %}
{% blocktranslate trimmed %} Deletes an item from the gallery; if the item is an album, all its subalbums and photographs inside it are eliminated too. {% endblocktranslate %}
{% blocktranslate trimmed %} Warning: This operation is destructive; once a photograph has been eliminated, the only way to bring it back is to upload it again. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: delete_item
- Parameters: The path to an element in the gallery
- Authentication: Yes
- Use:
{% endblocktranslate %}
curl -H 'Authorization: Token {{token}}' \ {{galeria_url}}/rest/delete_item?path={{galeria.now_year}}/
{% translate "Reset highlighted items" %}
{% blocktranslate trimmed %} Resets the highlighted items in the gallery. When resetting the highlighted items, the first photograph of an event becomes its highlighted item; and the first album of a month or year becomes the highlighted item of the containing album. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: reset_highlights
- Parameters: None
- Authentication: Yes
- Use:
{% endblocktranslate %}
curl -H 'Authorization: Token {{token}}' \ {{galeria_url}}/rest/reset_highlights
{% translate "Download highlighted items" %}
{% blocktranslate trimmed %} Downloads the highlighted items of the gallery, in a JSON formated file. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: get_highlights
- Parameters: None
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/get_highlights
{% translate "Upload highlighted items" %}
{% blocktranslate trimmed %} Uploads the highlighted items to the gallery, from a JSON formated file. {% endblocktranslate %}
-
{% blocktranslate trimmed %}
- Method: set_highlights
- Parameters: The JSON file with the highlighted items
- Authentication: No
- Use:
{% endblocktranslate %}
curl -H 'Authorization: Token {{token}}' \ -H 'Content-Type: application/json' -d@highlights.json \ {{galeria_url}}/rest/set_highlights