Design REST API

Pasted image 20240623123208.png

Pasted image 20230902192131.png

[!note]
TL;DR:Ā Best practice for RESTful API design is thatĀ path paramsĀ are used toĀ identify a specific resource or resources, whileĀ query parametersĀ are used toĀ sort/filter those resources.

GETĀ `/cars?color=blue`

Token base authentication

Pasted image 20230903075642.png

HMAC authentication (API key)

Pasted image 20230903075708.png

  1. Step 1 and 2 is user getting the API key
  2. Step 3 user generate a HMAC key based on the private key and the meta data
  3. Step 4 user send this key to the server.
  4. Step 5 Server which then extract the metadata and generate a HMAC key on the server side
  5. Step 6 and 7 server compare the HMAC key that was generated in the client vs in the server. If they're matched then the server send back the resource.

Pasted image 20230911182338.png