In creating a post with 2 categories and 1 syndication target, using category and mp-syndicate-to which accept arrays, I see the following in the POST request:
{
"h": "entry",
"content": "Test.",
"post-status": "published",
"category[]": ["test", "testing"],
"mp-destination": "https://indiekit-sandbox.netlify.app",
"mp-syndicate-to[]": "https://mastodon.social/@indiekit_sandbox"
}
Note the array property keys include [], when they should not.
If I’m understanding this right, this might be confusing how application/json body is sent versus how the same information is sent using application/x-www-form-urlencoded.
An array should be provided in JSON as follows:
{
"h": "entry",
"content": "hello world",
"category": ["foo", "bar"],
}
Only when form encoding arrays do multiple values get appended with [], meaning the above would be represented as:
h=entry&content=hello+world&category[]=foo&category[]=bar
This is as documented in the Micropub spec.
In creating a post with 2 categories and 1 syndication target, using
categoryandmp-syndicate-towhich accept arrays, I see the following in thePOSTrequest:{ "h": "entry", "content": "Test.", "post-status": "published", "category[]": ["test", "testing"], "mp-destination": "https://indiekit-sandbox.netlify.app", "mp-syndicate-to[]": "https://mastodon.social/@indiekit_sandbox" }Note the array property keys include
[], when they should not.If I’m understanding this right, this might be confusing how
application/jsonbody is sent versus how the same information is sent usingapplication/x-www-form-urlencoded.An array should be provided in JSON as follows:
{ "h": "entry", "content": "hello world", "category": ["foo", "bar"], }Only when form encoding arrays do multiple values get appended with
[], meaning the above would be represented as:This is as documented in the Micropub spec.