curl creates empty review (via API)
-
Hi there!
First of all, thank you for your work. Very thoughtful plugin you made.
Second of all =) Sorry for my english.And finally… Sorry to bother you, but I have a situation in which I apparently need your help.
I’m trying to create review on my website using linux curl, but I’m getting very strange answer from API and the review’s created empty.
Here is my curl-string:
curl –user “APP-USER:APP-PASS” -X POST ‘https://hostnamedotcom/wp-json/site-reviews/v1/reviews’ -d ‘{“assigned_posts”:”59″,”name”:”Reviewer Name”,”content”:”Review content”,”rating”:”2″,”avatar”:”https:\/\/hostnamedotcom\/wp-content\/uploads\/user-avatars\/user-avatar-2872.jpg”,”is_approved”:true}’APIs answer is:
{“assigned_posts”:[],”assigned_terms”:[],”assigned_users”:[],”author”:1,”avatar”:”https:\/\/secure.gravatar.com\/avatar\/d7348ddc5eff3b1cb2465fcfa15954d0?s=80&d=mm&r=g”,”content”:””,”custom”:[],”date”:”2023-08-0
2T08:54:35″,”date_gmt”:”2023-08-02T05:54:35″,”id”:549,”is_approved”:true,”is_modified”:false,”is_pinned”:false,”is_verified”:false,”meta”:{“_glsr_average”:0,”_glsr_ranking”:0,”_glsr_reviews”:0},”modified”:”2023-
08-02T08:54:35″,”modified_gmt”:”2023-08-02T05:54:35″,”name”:”admin”,”rating”:0,”response”:null,”score”:0,”status”:”publish”,”terms”:false,”title”:””,”type”:”local”,”_links”:{“self”:[{“href”:”https:\/\/hostnamedotcom\/wp-json\/site-reviews\/v1\/reviews\/549″}],”collection”:[{“href”:”https:\/\/hostnamedotcom\/wp-json\/site-reviews\/v1\/reviews”}],”about”:[{“href”:”https:\/\/hostnamedotcom\/wp-json\/wp\/v2\/types\/site-review”}
],”version-history”:[{“count”:0,”href”:”https:\/\/hostnamedotcom\/wp-json\/site-reviews\/v1\/reviews\/549\/revisions”}],”wp:attachment”:[{“href”:”https:\/\/hostnamedotcom\/wp-json\/wp\/v2\/media?parent=549″}],”wp:te
rm”:[{“embeddable”:true,”taxonomy”:”site-review-category”,”href”:”https:\/\/hostnamedotcom\/wp-json\/wp\/v2\/site-review-category?post=549″}],”curies”:[{“name”:”wp”,”href”:”https:\/\/api.w.org\/{rel}”,”templated”:
true}]}}Looks like API can not see my json, or can not parse it and creates review with some default fields.
Please, help me understand what am i doing wrong?
The topic ‘curl creates empty review (via API)’ is closed to new replies.