• Resolved danilopaulinodasilva

    (@danilopaulinodasilva)


    Hi! Just have installed the plug-in and with all my tests, responses are blank! I’m doing something very wrong?

    My JSON response for /wp-json/wp/v2/posts

    {
            "id": 26,
            "date": "2018-01-17T17:29:58",
            "date_gmt": "2018-01-17T19:29:58",
            "guid": {
                "rendered": "https://localhost/yhall/?p=26"
            },
            "modified": "2018-01-23T16:02:39",
            "modified_gmt": "2018-01-23T18:02:39",
            "slug": "eudora",
            "status": "publish",
            "type": "post",
            "link": "https://localhost/yhall/eudora/",
            "title": {
                "rendered": "Eudora"
            },
            "content": {
                "rendered": "",
                "protected": false
            },
            "excerpt": {
                "rendered": "",
                "protected": false
            },
            "author": 1,
            "featured_media": 0,
            "comment_status": "open",
            "ping_status": "open",
            "sticky": false,
            "template": "",
            "format": "standard",
            "meta": [],
            "categories": [
                1
            ],
            "tags": [
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10,
                11,
                12,
                13,
                14
            ],
            "acf": {
                "titulodaoferta": "Que tal ganhar mais um salário aproveitando os produtos Eudora?",
                "descricaodaoferta": "",
                "offer_id": "1834",
                "capping_de_conversoes": "30000",
                "capping_de_cliques": "10000",
                "titulodapergunta1": "Sim, me mostre como!",
                "acaodapergunta1": "nothing",
                "titulodapergunta2": "N?o quero saber",
                "acaodapergunta2": "nothing",
                "vertical": [
                    "Gostei.club"
                ],
                "titulodapergunta3": "",
                "acaodapergunta3": "delivery",
                "titulodapergunta4": "",
                "acaodapergunta4": "delivery",
                "affiliation": [
                    "Survey",
                    "Corredor"
                ],
                "sexo": "m",
                "dispositivo": "Mobile",
                "idade_maior_que": "18",
                "idade_menor_que": "70",
                "ddd": [
                    "21"
                ],
                "imagem": {
                    "id": 30,
                    "alt": "",
                    "title": "eudora",
                    "caption": "",
                    "description": "",
                    "mime_type": "image/jpeg",
                    "url": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-e1516713693952.jpg",
                    "width": 300,
                    "height": 250,
                    "sizes": {
                        "thumbnail": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-150x150.jpg",
                        "thumbnail-width": 150,
                        "thumbnail-height": 150,
                        "medium": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-300x250.jpg",
                        "medium-width": 300,
                        "medium-height": 250,
                        "medium_large": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-e1516713693952.jpg",
                        "medium_large-width": 300,
                        "medium_large-height": 250,
                        "large": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-e1516713693952.jpg",
                        "large-width": 300,
                        "large-height": 250,
                        "twentyseventeen-featured-image": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-e1516713693952.jpg",
                        "twentyseventeen-featured-image-width": 300,
                        "twentyseventeen-featured-image-height": 250,
                        "twentyseventeen-thumbnail-avatar": "https://localhost/yhall/wp-content/uploads/2018/01/eudora-100x100.jpg",
                        "twentyseventeen-thumbnail-avatar-width": 100,
                        "twentyseventeen-thumbnail-avatar-height": 100
                    }
                },
                "url": "https://ads.trackify.cc/aff_c?offer_id=1834&aff_id=1208",
                "teste": [
                    {
                        "term_id": 6,
                        "name": "14",
                        "slug": "14",
                        "term_group": 0,
                        "term_taxonomy_id": 6,
                        "taxonomy": "post_tag",
                        "description": "",
                        "parent": 0,
                        "count": 1,
                        "filter": "raw"
                    },
                    {
                        "term_id": 8,
                        "name": "16",
                        "slug": "16",
                        "term_group": 0,
                        "term_taxonomy_id": 8,
                        "taxonomy": "post_tag",
                        "description": "",
                        "parent": 0,
                        "count": 1,
                        "filter": "raw"
                    }
                ]
            },
            "_links": {
                "self": [
                    {
                        "href": "https://localhost/yhall/wp-json/wp/v2/posts/26"
                    }
                ],
                "collection": [
                    {
                        "href": "https://localhost/yhall/wp-json/wp/v2/posts"
                    }
                ],
                "about": [
                    {
                        "href": "https://localhost/yhall/wp-json/wp/v2/types/post"
                    }
                ],
                "author": [
                    {
                        "embeddable": true,
                        "href": "https://localhost/yhall/wp-json/wp/v2/users/1"
                    }
                ],
                "replies": [
                    {
                        "embeddable": true,
                        "href": "https://localhost/yhall/wp-json/wp/v2/comments?post=26"
                    }
                ],
                "version-history": [
                    {
                        "href": "https://localhost/yhall/wp-json/wp/v2/posts/26/revisions"
                    }
                ],
                "wp:attachment": [
                    {
                        "href": "https://localhost/yhall/wp-json/wp/v2/media?parent=26"
                    }
                ],
                "wp:term": [
                    {
                        "taxonomy": "category",
                        "embeddable": true,
                        "href": "https://localhost/yhall/wp-json/wp/v2/categories?post=26"
                    },
                    {
                        "taxonomy": "post_tag",
                        "embeddable": true,
                        "href": "https://localhost/yhall/wp-json/wp/v2/tags?post=26"
                    }
                ],
                "curies": [
                    {
                        "name": "wp",
                        "href": "https://api.w.org/{rel}",
                        "templated": true
                    }
                ]
            }
        }

    When I try /wp-json/wp/v2/posts?filter[meta_key]=tags&filter[meta_value]=11 the response are []. When I try /wp-json/wp/v2/posts?filter[meta_key]=id&filter[meta_value]=26 the response are [].

Viewing 1 replies (of 1 total)
  • Plugin Author sk8tech

    (@sk8tech)

    Hi Danilo,

    Thank you for your message.

    WP REST Filter restores the ‘filter’ function that’s removed from WordPress 4.7. It is used to filter meta fields.

    If you wish to find posts with tags or by id, you should use endpoints in WP 4.7 Official REST API. That’s
    https://developer.www.ads-software.com/rest-api/reference/posts/#list-posts (see arguments tab)

    For tags (Included in WP 4.7+, no plugin required)
    /wp-json/wp/v2/posts?tags=10

    For post with specific id (Included in WP 4.7+, no plugin required)
    /wp-json/wp/v2/posts/<id>

    For post filtered with meta key & value (Done by WP REST Filter, E.g. currency USD)
    /wp-json/wp/v2/posts?filter[meta_key]=currency&filter[meta_value]=USD

    BR,
    Jack

Viewing 1 replies (of 1 total)
  • The topic ‘Empty response’ is closed to new replies.