Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get json response from wordpress website

I am developing an android app. I dont know anything about wordpress database or how to get data from the website. I googled for how to get data from the wordpress database I have got to know I could get json response from JSON API plugin of the wordpress. but It's hard for me to understand.

I am using food bakery theme for wordpress.

I just want to know how do I get required json response from this website. And where the data of products in that website is located in database.

for example : product,categories etc. etc

My expected response is something like this

{"Category":[{"ProductSubGroupCategoryCode":"PSG03","ProductGroupCategoryCode":"PG01","Description":"WRAPS"
,"CHello SirreatedBy":"101","CreatedDate":"\/Date(1486116932060)\/","ModifiedBy":null,"ModifiedDate":null}]},
{"SubCategory":[{"ProductID":"01","Description":"VEG BURGER","ReferanceID":"VEG BURGER","UOM":"EA","AlterUOM":"EA",
"ProductGroupCategoryCode":"PG01","ProductSubGroupCategoryCode":"PSG01","TaxCategoryCode":"","TaxCode":"VAT5","BuyPrice":100,
"AttributeCode":"PA01","BasicPrice":190.48,"TaxRate":5.00,"SalesPrice":200.00,"ProductImage":null,"CurrentStock":10,
"PlantCode":"PC01","StoreLocationCode":"S01","DisplayOnPOS":true,"POSDisplayOrder":0,"CreatedBy":"101",
"CreatedDate":"\/Date(1486446663333)\/","ModifiedBy":"101","ModifiedDate":"\/Date(1486447253063)\/"}

Edit: I tried with WP REST API i have come upto, when i use this link it gives me response with id 1 http://localhost/mysite/wp-json/wp/v2/posts/1. when when I have tried with other post IDs it gives me blank response.

FYI I got post ID for that certain post from wordpress_posts table of wordpress database

like image 540
parish Avatar asked Nov 08 '22 21:11

parish


1 Answers

if you want to get post:

https://example.com/wp-json/wp/v2/posts

if you want to get a particular post

https://example.com/wp-json/wp/v2/posts/1852

 whereas 1852 is the id of the post
like image 159
Muhammad Arslan Avatar answered Nov 15 '22 06:11

Muhammad Arslan