Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#40116 closed defect (bug) (invalid)

Since 4.7.3 the json output for the REST API is wrongly formatted breaking Android APP

Reported by: tottaz's profile tottaz Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7.3
Component: REST API Keywords:
Focuses: rest-api Cc:

Description

There is an issue with the json output in v 4.7.3 - it breaks the Android App - I have. This has been working fine, tills version 4.7 then it started to work with 4.7.1 now it's not working again.

The issue code be an language encoding issue, you could look at my output

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

You can see that it starts failing on the html output code </a> and all output is a link reference.

I have another site running on the same multi-site setup, that also has issues - the site is

https://thelonelycyclist.org/wp-json/wp/v2/posts/

It shows that the issues is with the JSON Output response to a REST API call, I hope you can identify and fix.

I have tested this on my staging host with similar results.

Change History (3)

#1 @tottaz
8 years ago

  • Focuses rest-api added
  • Severity changed from normal to blocker

#2 @swissspidy
8 years ago

  • Keywords close added
  • Severity changed from blocker to normal

Hey there,

Thanks for your report and welcome to Trac!

I assume you refer to the WordPress Android app?

From what I can see, both of your sites are behind Cloudflare, which seems to return these response as text/html instead of application/json. So you probably just need to adjust your caching rules there to not cache everything under wp-json.

Because when I access something like https://thelonelycyclist.org/wp-json/?foo, Cloudflare bypasses the cache because of the query parameter and properly serves application/json.

#3 @rmccue
8 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Per @swissspidy's comment above, this appears to be a problem with the server configuration. In any case, it appears to be working for me on the above URLs now, so closing out as invalid. :)

Note: See TracTickets for help on using tickets.