Skip to content

Latest commit

 

History

History
84 lines (65 loc) · 3.13 KB

README.md

File metadata and controls

84 lines (65 loc) · 3.13 KB

CDDL-Beirut API Documentation

Last updated: 5/30/2022

Endpoints

All GET endpoints return a JSON-formatted string in the form {"message": message, "response", response}, where response contains the actual data. The message property is a message indicating success or failure, and may provide additional information.

Images

GET /api/imagesImageMeta[]

Gets all of image metadata from the database.

GET /api/images/<id>ImageMeta[]

Gets the image metadata by ID.

Users may provide an image ID (img_id), in which case the particular image metadata object is returned, or a survey response ID (response_id), in which case all image metadata for that response is returned. In either case, an array of image metadata objects is returned.

GET /api/images/<id>.(jpg|png|...)ImageData

Retrieves the actual image given the image filename formatted as img_id.<extension>.

Workshops

GET /api/workshopsWorkshop[]

Gets all workshops from the database.

GET /api/workshops/<ID>Workshop

Retrieves a workshop by its ID property from the database.

POST /api/workshopsWorkshop

Body:

 workshop: WorkshopType
 imageMetas: ImageMetaType[]
 imageDatas: ImageDataType[]

The request body must be an object containing the workshop to be added, an array of associated image metadata, and an array of associated image data.

Creates a new workshop and saves it to the database. Data is "application/json"-formatted and is sent in the POST request body. The endpoint returns the newly created workshop to confirm it was created.

Note: This endpoint will also create and save an image metadata object if a photo is provided.

Archive Information

GET /api/archiveArchiveObject[]

Gets all of the archive response objects from the database.

GET /api/archive/<ID>ArchiveObject

Retrieves and archive object by its ID property from the database.

POST /api/archiveArchiveObject

Body:

 archive: ArchiveType
 imageMetas: ImageMetaType[]
 imageDatas: ImageDataType[]

The request body must be an object containing the archive information object to be added, an array of associated image metadata, and an array of associated image data (if applicable).

Creates a new archive object and saves it to the database. Data is "application/json"-formatted and is sent in the POST request body. The endpoint returns the newly created archive information object to confirm it was created and saved.

Note: This endpoint will also create and save an image metadata object for data containing visual content.

Stickers

POST /api/whatsappTwiMLResponse

Webhook for the WhatsApp API. Send a code to the number provided in WhatsApp, and the endpoint will return a TwiML response that contains the oldest image associated with that sticker and a description in the form of a WhatsApp message.