Search code examples
jsonapivimeovimeo-api

vimeo-api remove part of JSON response


Is possible (sending a specific parameter in request) remove part of JSON response?

Like the Youtube API v3 part parameter: The part parameter specifies a comma-separated list of one or more video resource properties that the API response will include.

Thanks,


Solution

  • The Vimeo API supports a fields whitelist, so instead of saying "exclude this", you include a list of everything you want.

    There is more documentation here: https://developer.vimeo.com/api/spec#json-filter

    But the idea is you add the parameter fields, and a comma separated list of fields. Nested data should be broken up with periods. So the following representation

    {
        "name": "dashron",
        "websites": [{
            "name": "facebook"
        },{
            "name": "twitter"
        }],
        "metadata": {
            "albums": {
                "uri": "...",
                "options": "...",
                "total": "..."
        }
    }
    

    Is the result of an API call with the following fields parameter fields=name,websites.name,metadata.albums