rest api – posts/new v1.1 endpoint returning HTTP status 400 for a very simple post

Question

all. My app’s getting an HTTP 400 response with little else to go on, for a fairly simple “posts/new” request to a user’s wordpress.com-hosted site. I’ve been unable to reproduce the problem with my own wordpress.com test sites. Below are the request details for the failing case (customer’s email anonymized). Any idea what could be going wrong? My app has obtained and is using “global” scope OAuth2 permissions for the customer’s wordpress.com account. He had a Jetpack configuration problem in his account/site that prevented REST API usage before, but wordpress.com customer support supposedly fixed that for him and my app is definitely able to get farther than before in communicating with his site.

Send of "Untitled Post" failed:
request URL=https://public-api.wordpress.com/rest/v1.1/sites/29859527/posts/new?context=edit
requestParameters={
 author = "user@users-domain.com";
 categories = (
 Uncategorized
 );
 content = "<!-- wp:paragraph -->\n<p>Write your post content here.</p>\n<!-- /wp:paragraph -->";
 date = "2022-05-02T23:48:46Z";
 format = standard;
 status = draft;
 title = "Untitled Post";
}

The response carries HTTP status code 400 and not much to go on in the header fields, as far as I can discern:

Status Code: 400, Headers {
 "Access-Control-Allow-Origin" = (
 "*"
 );
 "Cache-Control" = (
 "no-cache, must-revalidate, max-age=0"
 );
 Connection = (
 "keep-alive"
 );
 "Content-Type" = (
 "application/json"
 );
 Date = (
 "Mon, 02 May 2022 23:48:47 GMT"
 );
 Expires = (
 "Wed, 11 Jan 1984 05:00:00 GMT"
 );
 "Host-Header" = (
 "WordPress.com"
 );
 Server = (
 nginx
 );
 "Strict-Transport-Security" = (
 "max-age=15552000"
 );
 "Transfer-Encoding" = (
 Identity
 );
 "X-ac" = (
 "1.syd _bur"
 );
 "X-hacker" = (
 "Oh, Awesome: Opossum"
 );

Thank you,
Troy Stephens
Coherence Labs, LLC

0
Troy Stephens 3 months 2022-05-02T19:29:23-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse