Answers.Body: <p>EDIT </p>
  
  <p>This is a case of staring at your computer for too long. The sections needs to be an array so it should've been </p>
  
  <pre><code>$this-&gt;addMetadata("links.sections", ["https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"]);
  </code></pre>
  
  <p>and not </p>
  
  <pre><code>$this-&gt;addMetadata("links.sections", "https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-12T20:17:20.960Z
Answers.LastActivityDate: 2020-02-12T20:17:20.960Z
Answers.UserDisplayName: zhua89
Body: <p>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. </p>
  
  <p>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</p>
  
  <p><code>$this-&gt;addMetadata("links.sections", "https://news-api.apple.com/sections/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");</code></p>
  
  <p>Here is the doc from apple news <a href="https://developer.apple.com/documentation/apple_news/code" rel="nofollow noreferrer">https://developer.apple.com/documentation/apple_news/code</a></p>
  
  <pre><code>[code] =&gt; 400
  [message] =&gt; HTTP/1.1 400 Bad Request
  [response] =&gt; stdClass Object
      (
          [errors] =&gt; Array
              (
                  [0] =&gt; stdClass Object
                      (
                          [code] =&gt; INVALID_TYPE
                      )
  
              )
  
      )
  </code></pre>
  
  <p>)
   in /app/vendor/chapter-three/apple-news-api/src/PublisherAPI/Base.php on line 197</p>
  
  <p>The error message isn't providing a key path with a field name so I'm a little lost as to debuggin the error.</p>
  
  <p>If anyone has experience with the plugin and can point me in the right direction that would be great!</p>
  
Tags: <plugins><plugin-applenews>
Title: Getting Invalid Type Error with no Key Path Value
ThreadText: # Getting Invalid Type Error with no Key Path Value
  
  (Asked by: username_0 on 2020-02-12)
  
  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!
  
  **Tags:** plugins, plugin-applenews
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-02-12. Score: 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");
  
  ```
  
  
  ---
  
  