Included resources

The eCurring API supports the inclusion of any related resource directly in the response. This prevents any extra roundtrips to the server to fetch the related data, but may increase the response time of the server.

Inclusion is possible on a resource collection, or on a single resource.

Parameters

include
string
A comma separated list of relationships to include in the response.

Example

In this example we will fetch all subscriptions and include the customer in the response.

Request

GET /subscriptions?include=customer HTTP/1.1
X-Authorization: 53b9e049186e04743bcdd685ea0bafbd1ff9e0c7f

Response

{
    "meta": {
        "total": 10
    },
    "links": {
        "self": "https://api.ecurring.com/subscriptions?page[number]=1&page[size]=10",
        "first": "https://api.ecurring.com/subscriptions?page[number]=1&page[size]=10",
        "last": "https://api.ecurring.com/subscriptions?page[number]=7&page[size]=10",
        "prev": null,
        "next": "https://api.ecurring.com/subscriptions?page[number]=2&page[size]=10"
    },
    "data": [
        {
            "type": "subscription",
            "id": "1",
            "links": {
                "self": "https://api.ecurring.com/subscriptions/1"
            },
            "attributes": {
                "mandate_code": "ECUR-MANDATE-01",
                "mandate_accepted": false,
                "mandate_accepted_date": null,
                "start_date": "2017-12-08T11:24:54+01:00",
                "status": "unverified",
                "cancel_date": null,
                "resume_date": null,
                "confirmation_page": "https://app.ecurring.com/mandate/accept/1/ECUR-MANDATE-01",
                "confirmation_sent": false
            },
            "relationships": {
                "subscription-plan": {
                    "data": {
                        "type": "subscription-plan",
                        "id": "1"
                    }
                },
                "customer": {
                    "data": {
                        "type": "customer",
                        "id": "1"
                    }
                },
                "transactions": {
                    "links": {
                        "self": "https://api.ecurring.com/subscriptions/1/relationships/transactions"
                    }
                }
            }
        },
        { ... }
    ],
    "included": [
        {
            "type": "customer",
            "id": "1",
            "links": {
              "self": "https://api.ecurring.com/customers/1"
            },
            "attributes": {
              "gender": "m",
              "first_name": "Jeroen",
              "middle_name": null,
              "last_name": "van der Geer",
              "bank_holder": "J. van der Geer",
              "iban": "NL66ECUR0123456789",
              "postalcode": "1016EE",
              "house_number": "313",
              "house_number_add": "",
              "street": "Keizersgracht",
              "city": "Amsterdam",
              "country_iso2": "NL",
              "email": "jvdgeer@example.com",
              "telephone": "+31202616739"
            },
            "relationships": {
              "subscriptions": {
                "links": {
                  "related": "https://api.ecurring.com/customers/1/subscriptions"
                },
                "data": [
                  {
                    "type": "subscription",
                    "id": "1"
                  }
                ]
              }
            }
        },
        { ... }
    ]
}