getkirby / kirby

Kirby's core application folder
https://getkirby.com
Other
1.32k stars 170 forks source link

API returns Error but page is still created #6692

Open linusrogge opened 2 months ago

linusrogge commented 2 months ago

Description

When using the API route /api/pages/:id/children to create a page, the API returns an error even though the page is still created.

Using localhost

{
    "status": "error",
    "message": "http://localhost:8000/panel/pages/entries+example",
    "code": 302,
    "exception": "Kirby\\Panel\\Redirect",
    "key": null,
    "file": "/kirby/src/Panel/Panel.php",
    "line": 149,
    "details": [],
    "route": "pages/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)]+)/children"
}

Using live site

{
    "status": "error",
    "message": "https://archive.saman.design/panel/pages/entries+example",
    "code": 302,
    "key": null,
    "details": []
}

Expected behavior
The API should respond with a success message, using a code between 200 and 299

To reproduce

  1. Use the API at /api/pages/:id/children (eg. with Postman) to POST a new page with basic data
  2. See Panel, page should be created
  3. Request should return an error 302 response

Your setup

Kirby Version
Tried using both v4.4.0 and v4.3.1 (due to redirect errors mentioned in #6676).

Your system (please complete the following information)

linusrogge commented 2 months ago

In addition to this, finding the API documentation on getkirby.com was a little bit of work.

I wanted to get to https://getkirby.com/docs/reference/api/pages/children-create, but clicking on API → Pages in the Reference sidebar leads me to https://getkirby.com/docs/reference/objects/cms/api/pages instead. Managed to get to the page via search, after all.

This also seems to be an issue with API → Site and API → Users.

distantnative commented 2 months ago

Thanks for reporting this. I have already fixed the API reference links.