Python için kullandığım kodu basta uyarlayacak birine ihtiyacım var.
import requests
import base64
restapiurl = "https://domain.com/wp-json/wp/v2/posts/"
restapiuser = "admin"
restapipassword = "9hSR znn0 hVFe lnE8 mLNl SgFN"
credentials = restapiuser + ':' + restapipassword
token = base64.b64encode(credentials.encode())
restapiheader = {'Authorization': 'Basic ' + token.decode('utf-8')}
post_content = """
Makale içeriği
"""
post = {
'status' : 'future',
'title' : "Başlık",
'content': post_content,
'categories' : 1,
}
restapiresponce = requests.post(restapiurl , headers=restapiheader , json=post)
print(restapiresponce.status_code)