Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial doc API #272

Open
2 tasks
armintalaie opened this issue Nov 26, 2023 · 1 comment
Open
2 tasks

Partial doc API #272

armintalaie opened this issue Nov 26, 2023 · 1 comment
Assignees
Labels

Comments

@armintalaie
Copy link
Contributor

implementing the doc manipulations for S3 via an API

  • currently only have a GET

  • good to look into the API conventions - especially for future-proofing

    • does not seem like a good idea to use query params only. my opinion is something like {baseURL}/area/{areaid}/docs/{docid}
    • helps keep it consistent + later for easily adding filter (e.g. {baseURL}/area/{areaid}/docs?q=meeting%20notes
    • check Github API for examples
  • good to look into HTTP Responses especially for cleaner access

Acceptance Criteria

  • can use an endpoint (DELETE) to delete a doc via its path
    • case 1: successful
    • case 2: unsuccessful - file does not exist
    • case 3: unsuccessful - cannot access (this will be just placeholder)
  • can use an endpoint (PATCH) to update a doc via its path
    • case 1: successful
    • case 2: unsuccessful - file does not exist
    • case 3: unsuccessful - cannot access (this will be just placeholder)
  • update the GET endpoint to retrieve a doc via its path
    • case 1: successful
    • case 2: unsuccessful - file does not exist
    • case 3: unsuccessful - cannot access (this will be just placeholder)
  • an API reference doc for these endpoints (for documentation - could live inside a readme file)

would not need to be safeguarded by user auth at this point

@KeveenWong
Copy link
Contributor

KeveenWong commented Dec 2, 2023

DELETE endpoint
case 2: unsuccessful - file does not exist
deleteObject(params = {}, callback) ⇒ AWS.Request
Removes an object from a bucket. The behavior depends on the bucket's versioning state:

If versioning is enabled, the operation removes the null version (if there is one) of an object and inserts a delete marker, which becomes the latest version of the object. If there isn't a null version, Amazon S3 does not remove any objects but will still respond that the command was successful.

If versioning is suspended or not enabled, the operation permanently deletes the object.

Basically, S3 responds with a success if the object does not exist. if we want, i can do a check if the objectKey exists and throw an error if it doesnt.

PATCH endpoint
"If you upload an object with a key name that already exists in a versioning-enabled bucket, Amazon S3 creates another version of the object instead of replacing the existing object."

it seems there is no "PATCH" or "UPDATE" in s3; "No, there is no concept of updating a file on S3. A file on S3 is updated the same way it is uploaded in the first place - through a PUT object request." we will have to read the object, make changes to the object, and then write the entire object back to s3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants