keikaavousi / fake-store-api

FakeStoreAPI is a free online REST API that provides you fake e-commerce JSON data
https://fakestoreapi.com
MIT License
2.2k stars 423 forks source link

POST apis are returning just an object with id prop only #113

Open avinashcodelabs opened 1 year ago

avinashcodelabs commented 1 year ago

Hi,

I am trying out add product api - POST verb,

   fetch("https://fakestoreapi.com/products", {
      method: "POST",
      body: JSON.stringify({
        title: "test product",
        price: 13.5,
        description: "lorem ipsum set",
        image: "https://i.pravatar.cc",
        category: "electronic",
      }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json));

The above code returns just an object with id prop, expected behaviour is, it should return an object with id prop along with other props as well.

{id: 21}

Let me know if you need help in reproducing the issue or PR with a fix, just wanted to comfirm with you before digging deep on the issue.

keikaavousi commented 1 year ago

Hi, Thank you for using FakeStoreAPI! Yes, you are correct. It just returns a sample ID after adding a product, but it will be changed in the next version to return full props.

Happy coding! Let me know if you have any questions.

On Fri, Oct 6, 2023 at 7:23 PM avinashcodelabs @.***> wrote:

Hi,

I am trying out add product api - POST verb,

fetch("https://fakestoreapi.com/products", { method: "POST", body: JSON.stringify({ title: "test product", price: 13.5, description: "lorem ipsum set", image: "https://i.pravatar.cc", category: "electronic", }), }) .then((res) => res.json()) .then((json) => console.log(json));

The above code returns just an object with id prop, expected behaviour is, it should return an object with id prop along with other props as well.

{id: 21}

Let me know if you need help in reproducing the issue or PR with a fix, just wanted to comfirm with you before digging deep on the issue.

— Reply to this email directly, view it on GitHub https://github.com/keikaavousi/fake-store-api/issues/113, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMZHCAJZDNBEUG4CJ5I4RIDX6ASONAVCNFSM6AAAAAA5WAV7QWVHI2DSMVQWIX3LMV43ASLTON2WKOZRHEZTANBZGE4TGMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

avinashcodelabs commented 1 year ago

Hi @keikaavousi, Thanks for the quick reply. Has anyone working in it "return full props"? I would like to contribute to it, let me know if you need any help, I am proficient in JavaScript, Node.js and Express.

keikaavousi commented 1 year ago

I have fixed it, it will be ok within 1-2 days

On Mon, Oct 9, 2023 at 11:31 AM avinashcodelabs @.***> wrote:

Hi @keikaavousi https://github.com/keikaavousi, Thanks for the quick reply. Has anyone working in it "return full props"? I would like to contribute to it, let me know if you need any help, I am proficient in JavaScript, Node.js and Express.

— Reply to this email directly, view it on GitHub https://github.com/keikaavousi/fake-store-api/issues/113#issuecomment-1752516462, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMZHCAPWASXWUCHYSY6VMFTX6OVOZAVCNFSM6AAAAAA5WAV7QWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJSGUYTMNBWGI . You are receiving this because you were mentioned.Message ID: @.***>