最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Rest API. Post content

matteradmin10PV0评论

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"
  }
}

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far