Bolt 5 API. Need an example of how to create a resource using api. #3191
Unanswered
igoreshik001
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am unable to create the resource. That's what I'm doing:
curl -X 'POST'
'http://127.0.0.1:8000/api/contents'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"contentType": "my-mail",
"status": "published",
"createdAt": "2022-04-29T04:30:47.749Z",
"modifiedAt": "2022-04-29T04:30:47.749Z",
"publishedAt": "2022-04-29T04:30:47.749Z",
"depublishedAt": "2022-04-29T04:30:47.749Z",
"fields": [
{
"name": "name",
"content": "text",
"value": [
"name2"
]
}
]
}'
This is my config/contenttypes.yaml
my-mail:
name: My Mail
singular_name: My Mail
fields:
name:
type: text
firma:
type: text
email:
type: email
message:
type: textarea
city:
type: text
checkbox:
type: checkbox
taxonomy: [ categories, tags, foobars ]
records_per_page: 5
order: id
icon_many: "fa:envelope"
icon_one: "fa:envelope"
Here is what comes in response:
403Undocumented | Error: Forbidden
{
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "An error occurred",
"detail": "Access Denied.",
"trace": [
{
"namespace": "",
"short_class": "",
"class": "",
"type": "",
"function": "",
"file": "C:\xampp\htdocs\bolt\vendor\symfony\security-http\Firewall\ExceptionListener.php",
"line": 138,
"args": []
},........
response headers:
cache-control: max-age=0,must-revalidate,private
connection: close
content-type: application/problem+json; charset=utf-8
date: Fri,29 Apr 2022 07:27:25 GMT,Fri,29 Apr 2022 07:27:25 GMT
expires: Fri,29 Apr 2022 07:27:25 GMT
host: 127.0.0.1:8000
link: http://127.0.0.1:8000/api/docs.jsonld; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"
referrer-policy: no-referrer,strict-origin-when-cross-origin
x-content-type-options: nosniff
x-debug-token: dc2a65
x-debug-token-link: http://127.0.0.1:8000/_profiler/dc2a65
x-frame-options: DENY
x-powered-by: PHP/8.1.2
x-previous-debug-token: 9a45ec
x-robots-tag: noindex
x-xss-protection: 1; mode=block
Beta Was this translation helpful? Give feedback.
All reactions