Hello. I have three questions about posting API.
1. Can you assign multiple categories to a post?
Let’s assume I have two categories implemented on my personal blog, named “First” and Second".
I write and execute this code on my personal blog:
token = "..."
headers ={
"content-type": "application/x-www-form-urlencoded; charset=utf-8",
"Authorization": f"Bearer {token}"}
sent = requests.post(
url="https://micro.blog/micropub?q=source",
headers=headers,
data={
"h": "entry",
"content": "Hello world",
"category": ['First', 'Second']
}
)
And it works. BUT, the published post will appear belonging only to the first category, and not to the second category.
Please, could you explain me what am I doing wrong?
2. Is it possible to query Micro.blog for a list of the existing blog categories?
I tried to send a GET request to /micropub?q=query
with this code:
sent = requests.get(
url="https://micro.blog/micropub?q=config",
headers=headers,
)
But I didn’t find a list of categories that I can apply to my posts, on the JSON object that was returned by the server.
Is there an endpoint I can send a GET request, to query for a list of the existing categories for my personal blog?
3. Is it possible to ask the Posting API to assign my new post a specific slug ?
If I send a POST request to the posting API, Micro.blog will create a new post and assigns it a permalink of its own accord.
Sometimes it’s apparently the time of the day or a serial number, for example: https://cesco.micro.blog/2023/05/24/175730.html
I’d rather be the one to suggest to micro.blog a slug suitable for my post.
I’d like to be able to post a new message and suggest a slug as in this (imaginary) piece of code:
token = "..."
headers ={
"content-type": "application/x-www-form-urlencoded; charset=utf-8",
"Authorization": f"Bearer {token}"}
sent = requests.post(
url="https://micro.blog/micropub?q=source",
headers=headers,
data={
"h": "entry",
"content": "Hello world",
"slug": "my-hello-world"
}
)
Micro.blog would try to implement my requested slug, and if that would not be possible (for example, because there are two posts sharing the same slug) it would return me an error code back and tell me that my requested slug can not be used.
Otherwise, it would publish my post with my requested permalink. For example:
https://cesco.micro.blog/2023/05/24/my-hello-world
Is this behavior doable now, or may be considered as a feature for the next future?
Many thanks for your replies. Cheers