How to handle POST REQUESTS

Hi guys! I'm trying to create a simple user,post and comments managment application. But, when I try to create a new post or comment I have some troubles. If I try to test post endpoint in the Rest Console, the result is always an error. I've another question about the results headers. Do you know if they works well?? Particularly I mean pagination headers: the current page is correct, while the number of results per page remains always 10 also if it's changed. Do you have encountered these issues? Thanks for the help!

Sample payload for post creation

{ "user_id": 7014014, "title": "Thalassinus despirmatio comburo arceo cometes curto.", "body": "Impedit harum strenuus. Cognomen thymbra coma. Concedo et facere. Chirographum spiculum auxilium. Deorsum illum auris. Aegrus studio suspendo. Crebro amplexus maiores. Tricesimus ceno et. Varietas absens coniuratio. Aurum clementia abbas. Molestias cursus adfero. Derelinquo deleniti acer. Amplitudo deorsum turpe. Aestivus victus apparatus. Usque adhuc vehemens." }

You can try the curl examples available in homepage (they can be converted to any language with help of chatgpt)

you can change the number of results per page upto 100, need pass query parameter per_page

Ex: /public/v2/users?page=1&per_page=20

  • Thanks for your help. I understand pagination query params but I don't know if it's an issue of the rest console. If I change the per_page param, the relative response header will not change(it's always 10) while the page param ('x-pagination-limit') will change in the right way: if I put page 2 it will be 2 for example, while the other param remains the same.
  • The post creation is working, very well. But not for comment. I'm trying to do this post and now I show you how I'm doing. URL: https://gorest.co.in/public/v2/posts/6940242/comments body: { "postid": 7014014, "name": "ema","email":"e@gmail.com", "body": "Impedit harum strenuus. Cognomen thymbra coma. " } response: "field post must exit" => why field post and not postid?? URL: https://gorest.co.in/public/v2/posts/6940242/comments => this ID is the same of the user. This is user's or post's id?? I think it's of the post but it's the same that I use for post creation where id is related to user. Body's name and email must exist? or, can I try with random one to test if it's working?

Thank you very much. Your tips will be very useful!

Do URL id must be equal to body's post_id?

pagination issue in headers is now fixed

POST https://gorest.co.in/public/v2/posts/6940242/comments in this we already have post id in url, no need to add again in body. Also make sure the post id is public or created/modified by you

Thanks, but if I try with this json : { "name":"Dev Tagore", "email": "devtagore@kessler-lebsack.test", "body": "ciao" } and url you provided https://gorest.co.in/public/v2/posts/6940242/comments, this is the answer: [ { "field": "post", "message": "must exist" } ] and if I try to add postid field like this: { "postid": 6940242, "name":"Dev Tagore", "email": "devtagore@kessler-lebsack.test", "body": "ciao" } the issue is the same, same answer

if you want to add comments to post 6940242 then that post must exits either in public data or created/modified by you.

Due space limitations, all user created/modified data will be removed after 6 days

also check GET https://gorest.co.in/public/v2/posts/6940242/

Now it works, thank you very much zeevy!!!


Little markdown supported