Support » Developing with WordPress » Rest API XML Output?

  • Is there a way to get the the exact same information from rest api endpoints in XML?

    Example: https://demo.wp-api.org/wp-json/wp/v2/posts

    I’m not looking for an RSS of latest posts, I want to use the rest api and customize what I pull as needed like I would using: https://demo.wp-api.org/wp-jsonwp/v2/posts?_embed=1&tags=XXX I just need it in XML…

    Is that possible or will I have to use a json to xml proxy script?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You would need a conversion somewhere no matter what. The API only speaks JSON by default. Similar to my suggestion in your other topic, you could create a custom route/endpoint that responds in XML.

    I’m not sure what’s all involved, but it might be possible to make custom RSS templates/code that accept additional arguments and reply with appropriate XML content. The advantage here would be RSS already speaks XML, but since you have to customize a response anyway, I don’t see a big advantage over custom REST routes.

Viewing 1 replies (of 1 total)
  • The topic ‘Rest API XML Output?’ is closed to new replies.