/api/v1

Posts

GET /posts/?page=1 (all posts)
    /posts/?page=1&sticky=1 (only sticky posts) 
    /posts/?page=1&sticky=0 (only non sticky posts)
    /posts/?meta=jobSeeker (only posts with meta=1 - pagination will be n/a)

{
    "data": [
        {
            "id": 57,
            "date": "2021-04-07T10:27:01",
            "title": "Post7",
            "content": "Tjena",
            "excerpt": "Tjena",
            "featured_media": {},
            "sticky": false,
            "tags": [
                {
                    "id": 9,
                    "name": "General",
                    "slug": "general",
                    "count": 1 // Number of posts having the tag
                }
            ]
        }
    ],
    "total": "1", // total posts overall
    "pages": "1" // number of pages
}

Single post

GET /posts/[id]

{
    "data": {
        "id": 57,
        "date": "2021-04-07T10:27:01",
        "title": "Post7",
        "content": "Tjena",
        "excerpt": "Tjena",
        "featured_media": {},
        "sticky": false,
        "tags": [
            {
                "id": 9,
                "name": "General",
                "slug": "general",
                "count": 1
            }
        ]
    },
    "total": "",
    "pages": ""
}

Single post by slug

GET /postbyslug/[slug]

{
    "data": {
        "id": 57,
        "date": "2021-04-07T10:27:01",
        "title": "Post7",
        "content": "Tjena",
        "excerpt": "Tjena",
        "featured_media": {},
        "sticky": false,
        "tags": [
            {
                "id": 9,
                "name": "General",
                "slug": "general",
                "count": 1
            }
        ]
    },
    "total": "",
    "pages": ""
}

Pages

GET /pages/?page=1
{
    "data": [
        {
            "id": 2,
            "date": "2021-03-24T13:21:28",
            "title": "Sample Page",
            "content": "hello world",
            "excerpt": "hello",
            "featured_media": {}
        }
    ],
    "total": "1", // total posts overall
    "pages": "1" // number of pages
}

Single page

GET /pages/[id]
{
    "data": [
        {
            "id": 2,
            "date": "2021-03-24T13:21:28",
            "title": "Sample Page",
            "content": "hello world",
            "excerpt": "hello",
            "featured_media": {}
        }
    ],
    "total": "",
    "pages": ""
}

Tags

GET /tags
{
    "data": [
        {
            "id": 9,
            "name": "General",
            "slug": "general",
            "count": 1
        }
    ]
}

Posts having tag

GET /tagposts/[tag_id]/?page=1 (all posts)
    /tagposts/[tag_id]/?page=1&sticky=1 (only sticky posts) 
    /tagposts/[tag_id]/?page=1&sticky=0 (only non sticky posts)


{
    "data": [
        {
            "id": 38,
            "date": "2021-03-31T11:37:56",
            "title": "Välkommen till en sprillans ny termin!",
            "content": "Är du redo att jobba? Härligt!",
            "excerpt": "Är du redo att jobba?",
            "featured_media": {},
            "sticky": false,
            "tags": [
                {
                    "id": 9,
                    "name": "General",
                    "slug": "general",
                    "count": 1
                }
            ]
        }
    ],
    "total": "1",
    "pages": "1"
}

Id by url - to get post/page id from urls embedded in wp-content

POST /idbyurl
Fields
    url = https://pamoja-hub-wp.earthpeople.dev/2021/03/25/post3/

{
    "data": {
        "type": "post",
        "id": 10
    }
}

Save user metadata to post

POST /savemeta/[post_id]
Fields
    post_id = 9
    key = read
    value = 1

{
    "result":"OK"
}

    

Get options

GET /options

{
    "data": {
        "acf": {
            "news_page_preamble": "Inget tjafs, inget trams!",
            "news_page_title": "Nyheter"
        }
    },
    "total": "",
    "pages": ""
}