Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
How would I resolve 422 this 422 error during POST?

I'm working on my React task. I've tried create new product and send it with post method. I use fetch and axios both. In both cases I got error 422. Here is Swager : https://newdemostock.gopos.pl/doc/swagger-ui/index.html?configUrl=%2Fv3%2Fapi-docs%2Fswagger-config&urls.primaryName=internal%20ajax&fbclid=IwAR0GUn4T42DxkREmZ6TNLdK5UlQYFPqEQltpmfCQ6iUBVDTwwIRBhoARoA8

Login: zadanie@gopos.pl

password: test

I've tried this endpoints : https://newdemostock.gopos.pl/ajax/219/products/create

Authorization: fd9ba9e1-0788-4e8f-ac46-a43df43e205e

OrganizationId : 219

Maybe I should have used another eindpoit? Does anyone know how I can solve this problem?
const NewProduct = () => {

  const product = {
    name: "test",
    item_name: "test",
  };
  const axiosConfig = {
    headers: {
      Authorization: `fd9ba9e1-0788-4e8f-ac46-a43df43e205e`,
      "content-type": "application/json",
      Accept: "application/json",
      //   mode: "cors",
      //   credentials: "same-origin",
    },
  };

  const sendProduct = async () => {
    axios
      .post(
        "https://newdemostock.gopos.pl/ajax/219/products/create",
        product,
        axiosConfig
      )
      .then((res) => {
        console.log("RESPONSE RECEIVED: ", res);
      })
      .catch((err) => {
        console.log("AXIOS ERROR: ", err);
      });

    // fetch("https://newdemostock.gopos.pl/ajax/219/products/create", {
    //     credentials: "same-origin",
    //   method: "post",
    //   mode: "cors",
    //   headers: new Headers({
    //     Authorization: "fd9ba9e1-0788-4e8f-ac46-a43df43e205e",
    //     "Content-Type": "application/json",
    //     Accept: "application/json",
    //   }),
    //   body: JSON.stringify(product),
    // })
    //   .then((resp) => console.log(resp))
    //   .catch((err) => console.log(err));
  };

  return (
    <div>
      <button onClick={sendProduct}>Send</button>
    </div>
  );
};


Here is a console.log

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

422 error means the request is well formed but not processable. So it seems your requests are making it to the desired endpoint but the server is unable to process them there.

If you have access to the backend server I would recommend adding console.logs to the route you are trying to hit, hit it with postman or your local client and then check the server logs. If you don't have access to the server I would double check any documentation the server custodians have provided and maybe get in touch with them.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!