Wp Rest Api request returns html not json format [closed]
Asked Answered
N

0

6

I am working on Wp Rest API. I want to retrieve posts from WordPress site that result to display in another PHP site. I have created a rest url "http://sitename.com/wp-json/wp/v2/posts" like this to get the posts. This request displays the data in html format but not in JSON format. I have tested two different URLs in PostMan application. How to get the API response into JSON format not html from WordPress site.

This is My URL data

enter image description here

This is Thirdparty URL data

enter image description here

Nammu answered 4/12, 2017 at 11:11 Comment(3)
Clear cache and remove plugin WP Super CacheInger
In postman, just change it to JSON in the dropdown. It autodetects the returned result. Since there's a lot of html in your response, it will auto format it to HTML.. You can still parse the results as per the documentation developer.wordpress.org/rest-api/reference/posts Postman is just returning it incorrectly.Claudette
Tarang Koradiya your suggestion is worked.....Thank youNammu

© 2022 - 2024 — McMap. All rights reserved.