Path not found / 404 on /api/collections/save

I can get data from a collection using the user token, however I cannot do this:

http://myapi.com/api/collections/save/posts?token=mytoken

Any attempt to save the data results in

Path not found

However

http://myapi.com/api/collections/get/posts?token=mytoken

will return JSON data.

I have my headers set to Content-Type application/json

and the body of the request is in valid JSON.

any ideas appreciated.

Hi!

http://myapi.com/api/collections/save/post

do you also provide a data object?

Do you mean JSON for each of the fields I want to update? If so, yes.

So your request looks like this:

fetch('/api/collections/save/posts?token=xxtokenxx', {
    method: 'post',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
        data: {
          fieldA: 'x',
          fieldB: 'y'
        }
    })
});

?

Looks like this:

        <?php

$request = new HttpRequest();
$request->setUrl('http://myapi.com/api/collections/save/docs');
$request->setMethod(HTTP_METH_POST);

$request->setQueryData(array(
  'token' => '**mytoken**'
));

$request->setHeaders(array(
  'Content-Type' => 'application/json'
));

$request->setBody('{
    "description": "This is a test entry",
    "thumbnailurl": "https://myblog.com/images/image.jpg",
    "contenturl": "none",
    "hostPageurl": "http://myblog.com/pages/page.html",
    "encodingformat": "jpeg"
}');

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

can you try this:

$request->setBody('{
    "data": {
      "description": "This is a test entry",
      "thumbnailurl": "https://myblog.com/images/image.jpg",
      "contenturl": "none",
      "hostPageurl": "http://myblog.com/pages/page.html",
      "encodingformat": "jpeg"
    }
}');

Same result. I am beginning to think it’s the way I installed Cockpit.

I am going to fire up a docker standard install instance, then replicate the table and try it again. Thanks for your help so far.

And me too :frowning:
What and where to look?