POST API data Error?

0 favourites
  • 9 posts
From the Asset Store
We present to you “Post Apocalyptic Trailer” – our newest hard hitting, bass rumbling designed movie trailer collection.
  • I'm trying to post api data but data not updating in server. What wrong I'm doing here?

    Tagged:

  • It looks like the server is responding 415 Unsupported media type. It's probably an issue with the server configuration or the way you make the request.

  • the way

    Does it means My way is wrong for posting data.

    I'm not a programmer. So its new thing for me.

  • If this issue is on server then what setting we have to do in server?

    If this is issue on how I'm posting data then how I should post the data? (what is the correct way of doing this?)

  • Try setting your ajax mime type before the request to something like: "application/json"

    Or you could try setting ajax request headers to:

    header = "Content-Type"

    value = "application/json"

    perhaps also

    header = "Accept"

    value = "application/json"

    Its been some time for me so I could be totally off ^_^

  • lennaert

    I added header = "Content-Type", value = "application/json"then I got error "400Bad Request"

  • lennaert

    I added header = "Content-Type", value = "application/json"then I got error "400Bad Request"

    "400 Bad Request

    The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (for example, malformed request syntax, invalid request message framing, or deceptive request routing)."

    Going by this, you likely have an error in the format of your request (how its build up) Compare the output string with a working example.

    IF you test in a browser, with the browser development tools you can check the content of your actual request.

    When you have the app running, (in chrome) press ctr + shift + j, select network tab. Below should be a list or a link which performed the attempted request. When you click it, the tabs next to it have all sorts of info, from the actual headers to the content of your request.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • after adding header = "Content-Type" and value = "application/json" is actually working. and error "400Bad Request" is showing because server avoiding any duplicate entry. So I change data and then its submitting successfully.

  • after adding header = "Content-Type" and value = "application/json" is actually working. and error "400Bad Request" is showing because server avoiding any duplicate entry. So I change data and then its submitting successfully.

    Fantastic !!

    Good luck

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)