I have an API with some specific resource say "cars" which have the following actions:

  • Get all Cars
  • Get one car
  • Add one car

for Get all cars and Get one Car, I have a REST api resouce with GET /cars and GET /cars/:car_id.

However adding a new car requires two steps:

  1. Get a presigned-URL to upload the car to S3 from the client
  2. The client should upload the data to S3 directly.

What would be the best approach to add to the existing API? should I use a separate resource endpoint? like GET /presigned-url or should I have a special sub-resource like /cars/presigned-url . Any other ideas?

  • REST has no such concept as a "sub resource". A URL identifies a resource; REST does not specify URL semantics -- i.e. REST does not imply any kind of URL structure, hierarchy, relationships, etc. REST only expects a URL to uniquely and consistently identify a resource, It's entirely up to you if you want to structure the URL in a way which represents some kind of structure or relationship semantics, but it's your API users who you should be asking those kinds of questions to, and try to work with whatever makes more sense to them (It's really a user requirements matter). Sep 8, 2022 at 6:55
  • Why is the client responsible for the upload?
    – Laiv
    Sep 8, 2022 at 8:25
  • @Laiv there are several use cases for that, this article somewhat explains it: leonid.shevtsov.me/post/demystifying-s3-browser-upload
    – obaqueiro
    Sep 8, 2022 at 16:05

1 Answer 1


If using the presigned-URL does not require any special knowledge from the client, you could implement the creation of a car like this:

  1. POST to /cars/
  2. The API creates the presigned-URL
  3. The API responds with a redirect to the S3 URL
  4. The client follows the redirect and posts the data to S3.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.