Hello,
I apologize for the issue you are facing. To edit the keyword on each blog post using the Rank Math SEO REST API, you can utilize the updatePost
endpoint. This allows you to update various fields of a post, including the focus keyword.
Here’s a general outline of how you can do this:
-
Prepare Your API Request: You will need to send a POST request to the following endpoint:
https://your-domain.com/hello-world`
Replace your-domain.com
with your actual domain.
-
Include Required Data: In the body of your request, include the post ID and the new focus keyword. The data should be structured in JSON format like this:
{
"id": "POST_ID",
"focus_keyword": "YOUR_NEW_KEYWORD"
}
Make sure to replace POST_ID
with the actual ID of the post you want to update and YOUR_NEW_KEYWORD
with the keyword you wish to set.
-
Authentication: Ensure that your request is authenticated properly, as the REST API requires authentication to make changes.
-
Send the Request: Use your automation tool (like n8n) to send this request whenever you want to update the keyword for a specific post.
If you encounter any issues or need further assistance with specific error messages, please reply to this ticket, and a human agent from our support team will assist you further.
Thank you for raising this concern!
Sources:
How to Enable Headless CMS Support in Rank Math? » Rank Math
I think some information is missing.
I get error: The resource you are requesting could not be found [item 0]
Hello,
We currently don’t have a documentation on where Rank Math stores the meta in the database, since we don’t have a dedicated API for changing the meta information.
You’ll have to create your own REST API and have the Rank Math meta update using simply the update_meta()
function.
All Rank Math metadata is stored in the wp_postmeta
table with the same prefix like so: rank_math_*
.
For the focus keyword, it should be: rank_math_focus_keyword
Some meta are stored with serialized data, so you’ll have to account for that as well.
Looking forward to helping you.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.