# Ottergram

> Our favorite otters are back, this time with the hint ***can you edit comments***

Normally I don't read the hint right away, but, busy day, busy life and all other excuses I can find, will be used to defend my choice to do it different today ⚔️

So because of the hint I obviously placed a comment at the first cute otter I saw.

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2FV8B3xKv9XybOpmDQajB1%2Fafbeelding.png?alt=media&#x26;token=adcd8415-b2e2-41f2-ac98-b6f2ee9e5c5b" alt=""><figcaption></figcaption></figure>

When I went back to see all the other comments, I noticed that `GET /api/posts/1/comments` was kinda 'chatty'.

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2FDskOBbwLNpLnRHUlSWbh%2Fafbeelding.png?alt=media&#x26;token=214523bc-9e4d-4e3a-8a1f-badb514f0f46" alt=""><figcaption></figcaption></figure>

So now I tried editing a comment by just changing the HTTP-verb from `GET` to `PUT` . And I tried changing someone else's comment right away. Busy life, no time, headache and a bunch of other excuses ⚔️.

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2FpgCo6aRl458Hmt4l1sCN%2Fafbeelding.png?alt=media&#x26;token=3eee4116-f042-4209-ae8b-c98a65375995" alt=""><figcaption></figcaption></figure>

Unfortunately, no luck. Maybe I could just use `POST` and **not** change the `id` of the original post. Maybe that would overwrite it.

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2Flv8neZNAWUkozwdh9XVl%2Fafbeelding.png?alt=media&#x26;token=77df947d-9855-44d3-8a4f-37bda76f604f" alt=""><figcaption></figcaption></figure>

But the response came back with a different `id`, so I kinda already knew that wasn't what I needed. 😞.

Ok, let's now assume that editing is already implemented in the backend, but not yet on the frontend. If I were to make an REST endpoint, it would be `PUT /api/posts/:postID/comments/:commentID`, so why not try that?

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2FwunprhYmxdCECkoM2cMa%2Fafbeelding.png?alt=media&#x26;token=9d4fd433-1e25-4421-b34f-c844fbf5fa60" alt=""><figcaption></figcaption></figure>

Ok, that seems like that worked! Let's go to the frontend and check if otters are, in fact, so boring 😑

<figure><img src="https://2622029278-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FV7OebgUO4GDe408WfphF%2Fuploads%2F0kdEg6xBDScmDV4y2X1c%2Fafbeelding.png?alt=media&#x26;token=53c347d5-c546-45ec-874a-b29ce99fb1bc" alt=""><figcaption></figcaption></figure>

Seems like the admin has something against otters! But don't mind if I take my flag! 🇧🇪
