I get a 405 when trying to send a POST request

In Strapi Admin panel I’ve created the collection type demo_request with three fields and with API ID demo-request

A’ve also giving rights to create new items for public user

But when I try to send a request, I’ve got an error 405: Method not allowed:
url: {baseURL}/api/demo-request
method: POST
status: 405

since this is a collection type i think you need to send it to demo-requests
demo-request doesn’t exist so you can’t do POST methods to them hence 405 means method not allowed.

Hello! Great! That’s work for me, but can you explain, why I need to add an ‘s’ in the end of request? I can’t find any article about it

Because it’s plural and Strapi uses plural for collections

OK, got it. Thank you!

The 405 response might happen if the data is wrapped around the “data” attribute.

Make sure you send:

  "data": {
    "firstName": "Kai" 

instead of

  "firstName": "Kai" 

custom api works right in localhost. But it is sending 405 error when deploying on VPS containerized with Docker. Why does it happen and how can I fix it?