Rest API. Post content

admin2025-06-05  2

Good afternoon everyone.

I have a website made with wordpress version 5.02. I want to use Rest Api functionality for developing native android application. At this address https://my-site/wp-json I receive a response with all endpoints available in Worpress Rest API.

I am interesting in getting post content by this url. https://my-site/wp-json/wp/v2/posts/4982 By this url I receive post info. By key "content", "rendered" I can get the post page in html format.

{
  "id": 4982,
  "date": "2018-03-18T17:26:46",
  "date_gmt": "2018-03-18T14:26:46",
  "modified": "2018-03-18T17:26:46",
  "modified_gmt": "2018-03-18T14:26:46",
  "slug": "relefnoe-telo",
  "status": "publish",
  "type": "post",
  "content": {
    "rendered": " html page here",
    "protected": false
  }}

I want to put the post info to my appication natively. Could you tell me please can I get post content in json format like this:

{
  content: {
    "title": "article title",
    "image": "",
    "gallery": [
      {
        "url": ""
      },
      {
        "url": ""
      }
    ],
    "descr": "description"
  }
}
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749069131a316085.html

最新回复(0)