Hi trying to test using the post method and getting Creation of ‘None’ is not allowed
Basically trying to follow the documentation below and pass the params as headers in postman. Its not clear what to pass.
http://localhost:8080/senaite/@@API/senaite/v1/create
Body Content type (application/json):
{
“portal_type”: “Client”,
“Name”: “Test Client”,
“ClientID”: “TEST-01”,
“parent_path”: “/senaite/clients”
}
xispa
(Jordi Puiggené)
May 26, 2020, 8:46pm
2
You need to call the create
operation after being logged in. The system tries to resolve login
as a portal type and returns None
because it obviously does not exist.
Do a GET Request first to authenticate. E.g.:
http://localhost:8080/senaite/@@API/senaite/v1/login?__ac_name=admin&__ac_password=admin
After being authenticated, do a POST with the create
operation:
http://localhost:8080/senaite/@@API/senaite/v1/create
Note that if you add the resource Client
before the operation create
you don’t need to specify the portal type (portal_type
parameter in the POST body). More information about how this works here: https://senaitejsonapi.readthedocs.io/en/creation-supported/crud.html#create
Hope it helps