Relationships

Getting related information from certain objects

Endpoints used to fetch information on the Everflow API return objects with a predefined structure. For example, when fetching an affiliate via the Find Affiliate By ID endpoint, only the Affiliate object is returned by default.

{
  "network_affiliate_id": 5,
  "network_id": 1,
  "name": "Google",
  "account_status": "active",
  "...": "..."
}

Relationships are used to extract additional information related to the object being queried. For example, when fetching an affiliate via the Find Affiliate By ID endpoint, requesting the users relationship would allow you to extract the affiliate users on top of the Affiliate object normally returned by the endpoint. The response would then look like :

{
  "network_affiliate_id": 5,
  "network_id": 1,
  "name": "Google",
  "account_status": "active",
  "...": "...",
  "relationship": {
    "users": {
      "total": 1,
      "entries": [
        {
          "network_affiliate_user_id": 12,
          "network_id": 1,
          "network_affiliate_id": 1,
          "first_name": "John",
          "last_name": "Doe",
          "...": "..."
        }
      ]
    }
  }
}

Requesting Relationships

You can ask for them using the relationship query parameter.

For example, fetching the affiliate ID 5 in the example above is done by making a GET call to /v1/networks/affiliates/5.

To modify the call and request the users relationship in the example above, the following URL would be queried instead : GET /v1/networks/affiliates/5?relationship=users

Note that multiple relationships can be requested at the same time. For example requesting both the users and signup relationships would be done by calling : GET /v1/networks/affiliates/5?relationship=users&relationship=signup

Availability

Relationships are not available on all endpoints. Endpoints where relationships are offered will be explicitly identified as such on the endpoint documentation.