Article API - {"errors":{"article":"Required parameter missing or invalid"}}

Solved
Highlighted

Hi there,

I'm getting an error when making a post request to /articles.json.

Request:

POST /admin/api/2020-07/blogs/{my_blogs_id}/articles.json

{
   "article": {
        "title": "My new Article title",
        "author": "John Smith",
        "tags": "This Post, Has Been Tagged",
        "body_html": "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
        "published_at": "Thu Mar 24 15:45:47 UTC 2011"
     }
}

Response:

{"errors":{"article":"Required parameter missing or invalid"}}
Please advise.
 
Thank you,
Kyle
Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.

We offer free and paid Shopify support.
Monday - Friday | 9 AM — 5 PM EST
Email: hello@freshnarrative.io | tel: (443) 345-8162
Baltimore, Maryland, United States
0 Likes
Highlighted
Shopify Partner
654 46 131

Without having actually hit the REST API endpoint, I would guess the published_at format isn't correct. Although the example POST in the specs match yours (https://shopify.dev/docs/admin-api/rest/reference/online-store/article#create-2020-07). If you perform a GET request for an existing article I'd imagine the formatting is the more traditional 2008-07-31T20:00:00-04:00. 

1 Like
Highlighted

This is an accepted solution.

Hi Greg_Kujawa, 

Thanks for the input! published_at format turned out to be correct. The error was due to the absence of 'application/json' in the request headers.

For those that are looking for a solution to this in the future, this was using the Requests library in Python.

Adding:

headers = {
     'Content-type' : 'application/json'
}

 to the POST request solved this.

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.

We offer free and paid Shopify support.
Monday - Friday | 9 AM — 5 PM EST
Email: hello@freshnarrative.io | tel: (443) 345-8162
Baltimore, Maryland, United States
0 Likes
New Member
5 0 0

I have use Article , but show error "Required parameter missing or invalid"

Here is my parameter

$tt = array(
"title"=> "My new Article title",
"author"=> "John Smith",
"tags"=> "This Post, Has Been Tagged",
"body_html"=> "<h1>I like articles</h1>\n<p><strong>Yea</strong>, I like posting them through <span class=\"caps\">REST</span>.</p>",
"published_at"=> "Thu Mar 24 15:45:47 UTC 2011"
);

 

Please what is issue this code?

0 Likes