Reputation: 856
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
Upvotes: 6
Views: 18239
Reputation: 1267
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
Upvotes: 4
Reputation: 731
You can access your posts json on wordpress with
http://oursite.com/wp-json/wp/v2/posts
Upvotes: 0
Reputation: 336
For getting JSON response from word press site you need to install certain open source plugin on word press site here is an WP API link Click here As per documentation You can also create custom API
Upvotes: 1