Querying Webhooks

Webhooks / Querying Webhooks

On this page:
Intro ▾
{{activeSubMenu.text}} ▾

If you are using Webhooks as your response method of choice, you can programmatically query a Webhook status and payload carried by that Webhook. You can get a single Webhook by its ID or get all the Webhooks for your account.

Available query string attributes

Webhooks can be filtered by status or date by using start and end parameters within the query string. When querying all Webhooks for an account, the API by default will return the 50 most recent entries per call. You may use the offset and limit parameters to paginate your results. The limit parameter can have a maximum value of 100.

AttributeTypeDescription
statusStringThis attribute takes a string which can be created, scheduled, dispatched, delivered or failed. You may query for multiple comma-separated status values.
startDateA UTC date in ISO-8601 format that describes begin date of the date range
endDateA UTC date in ISO-8601 format that describes end date of the date range
offsetIntegerAn integer value describing how many results should be skipped.
limitIntegerAn integer value describing how many results to return. Maximum 100.

Please note that all query string parameters are optional and used only if you would like to filter your results. An example cURL request using all possible parameters will look like the following:

curl -u your-api-key: https://api.pixaven.com/1.0/webhooks/?status=delivered,failed&start=2017-01-01T11:57:04.322Z&end=2017-01-10T11:57:04.322Z&offset=100&limit=10

Get one Webhook by ID

GET https://api.pixaven.com/1.0/webhooks/{id}
curl -u your-api-key: https://api.pixaven.com/1.0/webhooks/e9b30aa1-63d9-4be1-b1c4-38430d041d39

An example response:

HTTP/1.1 200 OK

Date: {{now}}
Status: 200 OK
Content-Type: application/json

{
    "success": true,
    "code": 200,
    "webhook": {
        "id": "e9b30aa1-63d9-4be1-b1c4-38430d041d39",
        "status": "delivered",
        "created_at": "2016-12-28T12:51:08.751Z",
        "updated_at": "2016-12-28T12:51:45.654Z",
        "code": 200,
        "payload": {
            "success": true,
            "code": 200,
            "id": "e9b30aa1-63d9-4be1-b1c4-38430d041d39",
            "input": {
                "name": "image.jpg",
                "format": "JPEG",
                "width": 858,
                "height": 536,
                "colorspace": "YCbCr",
                "interlaced": true,
                "subsample": "4:2:0",
                "depth": 24,
                "quality": 68,
                "bytes": 159992
            },
            "output": {
                "url": "http://dl.pixaven.com/e9/b3/0a/a1/63d9-4be1-b1c4-38430d041d39/image.jpg",
                "name": "image.jpg",
                "format": "JPEG",
                "width": 500,
                "height": 312,
                "colorspace": "YCbCr",
                "interlaced": true,
                "subsample": "4:2:0",
                "depth": 24,
                "quality": 83,
                "bytes": 62399
            }
        }
    }
}

As you can see in the above example, there are multiple nested code attributes. The top-most one (as with all API requests) refers to the API call querying a Webhook. The next occurance within the webhook hash refers to the status code received from the endpoint while delivering the Webhook. The last one within the payload hash describes the status of image processing.

Lets assume you're querying a Webhook which failed due to a non-existent endpoint provided (hence a 404 code and failed status) and the image processing that triggered that Webhook resulted in a 422 code due to a missing processing parameter. The response from the API will look like to following:

HTTP/1.1 200 OK

Date: {{now}}
Status: 200 OK
Content-Type: application/json

{
    "success": true,
    "code": 200,
    "webhook": {
        "id": "7a116bda-da28-4cd6-8d7a-c323428527f0",
        "status": "failed",
        "created_at": "2017-01-03T11:33:53.297Z",
        "updated_at": "2017-01-03T11:57:18.380Z",
        "code": 404,
        "payload": {
            "success": false,
            "code": 422,
            "id": "7a116bda-da28-4cd6-8d7a-c323428527f0",
            "message": "Adjust 'contrast' parameter must be an integer within -100 to 100 range"
        }
    }
}

Get all Webhooks for an Account

GET https://api.pixaven.com/1.0/webhooks
curl -u your-api-key: https://api.pixaven.com/1.0/webhooks

An example response:

HTTP/1.1 200 OK

Date: {{now}}
Status: 200 OK
Content-Type: application/json

{
    "success": true,
    "code": 200,
    "webhooks": [{
        "id": "6fab8ab3-039d-407d-8598-3d8826a8f171",
        "status": "scheduled",
        "created_at": "2017-01-03T12:00:15.608Z",
        "updated_at": "2017-01-03T12:00:15.865Z",
        "code": 0,
        "payload": {
            "success": true,
            "code": 200,
            "id": "6fab8ab3-039d-407d-8598-3d8826a8f171",
            "input": {
                "name": "image.jpg",
                "format": "JPEG",
                "width": 1680,
                "height": 1050,
                "colorspace": "YCbCr",
                "interlaced": false,
                "subsample": "4:4:4",
                "depth": 24,
                "quality": 92,
                "bytes": 376330
            },
            "output": {
                "url": "http://dl.pixaven.com/6f/ab/8a/b3/039d-407d-8598-3d8826a8f171/image.jpg",
                "name": "image.jpg",
                "format": "JPEG",
                "width": 500,
                "height": 313,
                "colorspace": "YCbCr",
                "interlaced": true,
                "subsample": "4:2:0",
                "depth": 24,
                "quality": 81,
                "bytes": 41854
            }
        }
    },
    {
        "id": "e9b30aa1-63d9-4be1-b1c4-38430d041d39",
        "status": "delivered",
        "created_at": "2016-12-28T12:51:08.751Z",
        "updated_at": "2016-12-28T12:51:45.654Z",
        "code": 200,
        "payload": {
            "success": true,
            "code": 200,
            "id": "e9b30aa1-63d9-4be1-b1c4-38430d041d39",
            "input": {
                "name": "image.jpg",
                "format": "JPEG",
                "width": 858,
                "height": 536,
                "colorspace": "YCbCr",
                "interlaced": true,
                "subsample": "4:2:0",
                "depth": 24,
                "quality": 68,
                "bytes": 159992
            },
            "output": {
                "url": "http://dl.pixaven.com/e9/b3/0a/a1/63d9-4be1-b1c4-38430d041d39/image.jpg",
                "name": "image.jpg",
                "format": "JPEG",
                "width": 500,
                "height": 312,
                "colorspace": "YCbCr",
                "interlaced": true,
                "subsample": "4:2:0",
                "depth": 24,
                "quality": 83,
                "bytes": 62399
            }
        }
    }]
}

We use both proprietary and third-party cookies to improve your browsing experience and to provide you with a better service. By continuing to use this site you consent our use of cookies as described in our Cookie Policy×