1

I am trying to specify a section to publish an article to and am using the addMetaData method in Article.php which my article class is extending.

The method in the base class allows for nested array properties by using a dot delimeter syntax so I have this right now in the init method of my article class

$this->addMetadata("links.sections", "https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");

Here is the doc from apple news https://developer.apple.com/documentation/apple_news/code

[code] => 400
[message] => HTTP/1.1 400 Bad Request
[response] => stdClass Object
    (
        [errors] => Array
            (
                [0] => stdClass Object
                    (
                        [code] => INVALID_TYPE
                    )

            )

    )

) in /app/vendor/chapter-three/apple-news-api/src/PublisherAPI/Base.php on line 197

The error message isn't providing a key path with a field name so I'm a little lost as to debuggin the error.

If anyone has experience with the plugin and can point me in the right direction that would be great!

1

EDIT

This is a case of staring at your computer for too long. The sections needs to be an array so it should've been

$this->addMetadata("links.sections", ["https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]);

and not

$this->addMetadata("links.sections", "https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.