πŸ‘¨β€πŸ’» Studentbox documentation

Search

Search IconIcon to open search

REST

Last updated Jan 28, 2023 Edit Source

REST (Representational state transfer) is a style of software architecture that takes advantage of HTTP(S):

Let’s say we have a database of recipes. We want to list them, add, modify and delete them. This can be done with a meaningful base path like /recipes. An API following REST principles would have those couples verbs/paths:

# File upload

For uploading files, we have several options. One is to use base64 encoding and put the result in JSON, but it’s not the best option for large files. Although we might never have big files (because we exchange coding files), it is something to consider for assets for example.

Another way of doing this through a multipart/form-data request1. The principle is to first upload the files independently from their metadata or any data you could send. Either first upload the files, get IDs and link them to the metadata (server controls names/ids) or upload metadata first and then files (client controls names/ids).


  1. libik and kirk (2020) REST API - file (ie images) processing - best practices, Stack Overflow. Available at: https://stackoverflow.com/questions/33279153/rest-api-file-ie-images-processing-best-practices (Accessed: January 13, 2023). ↩︎