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"}}
Solved! Go to the solution
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.
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.
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?
User | Count |
---|---|
28 | |
7 | |
7 | |
6 | |
4 |