{% 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 %} Returns a list of all the albums and their properties in the gallery, in JSON format. {% endblocktranslate %}
-
{% blocktranslate %}
- Method: list-albums
- Parameters:
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/list-albums
{% translate "List photographs" %}
{% blocktranslate trimmed %} Returns a list of all the photos and their properties in the gallery, in JSON format, in pages of 100 photos. {% endblocktranslate %}
-
{% blocktranslate %}
- Method: list-photos
- Parameters: The page to list; 1 by default
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/list-photos?page=3
{% 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 %}
- 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 %}
- 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 %}
- 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 covers" %}
{% blocktranslate trimmed %} Resets the covers in the gallery. When resetting the covers, the first photograph of an event becomes its cover; and the first album of a month or year becomes the cover of the containing album. {% endblocktranslate %}
-
{% blocktranslate %}
- Method: reset-covers
- Parameters: None
- Authentication: Yes
- Use:
{% endblocktranslate %}
curl -H 'Authorization: Token {{token}}' \ {{galeria_url}}/rest/reset-covers
{% translate "Download covers" %}
{% blocktranslate trimmed %} Downloads the covers of the gallery, in a JSON formated file. {% endblocktranslate %}
-
{% blocktranslate %}
- Method: get-covers
- Parameters: None
- Authentication: No
- Use:
{% endblocktranslate %}
curl {{galeria_url}}/rest/get-covers
{% translate "Upload covers" %}
{% blocktranslate trimmed %} Uploads the covers to the gallery, from a JSON formated file. {% endblocktranslate %}
-
{% blocktranslate %}
- Method: set-covers
- Parameters: The JSON file with the covers
- Authentication: No
- Use:
{% endblocktranslate %}
curl -H 'Authorization: Token {{token}}' \ -H 'Content-Type: application/json' -d@covers.json \ {{galeria_url}}/rest/set-covers