Affiliates

The operations on Affiliate are similar to Network, in that the interface is fully idempotent, and the create and update commands both expect the full set of affiliate sites and users each time. Similar to advertisers, you are not allowed to delete if one or more campaigns exist for this affiliate.

Property

Type

Value

id_from_network

string

The network object_id for this Affiliate. Unique within network.

name

string

The name of the Affiliate. Unique within the network.

status

string (one of): Applied, Approved (default), Declined, Suspended, Archived

Approval status for this affiliate.

sites

json array of hashes

1 or more pairs of id_from_network [and name].

id_from_network

string

The site id (PID).

name

string

The site name that matches site id_from_network.

users

json array of hashes

0 or more users for the organization. Each must have the first 5 fields below.

id_from_network

string

The network object_id for this user.

email_address

string in RFC 2822 addr-spec format

The user’s email address. Unique for this user.

first_name

string(must not be blank)

The user’s first name.

last_name

string(must not be blank)

The user’s last name.

phone_number

string in ITU E.164 format or 10-digit US form (no punctuation)

The user’s phone number.

role

One of: Super (default), Manager, Member, Observer

This user’s role in this organization. (A user may have different roles in different organizations)

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates/<affiliate_id_from_network>.json

Examples

Read all Affiliates for this network

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates.json

Request Body:

[
  {
    "id_from_network": "222",
    "sites": [
      {
        "id_from_network": "33567",
        "name": "http://www.surfoz.au"
      },
      {
        "id_from_network": "44920",
        "name": "http://www.blogspot.com/surfoz"
      }
    ],
    "name": "Surf Oz Magazine",
    "users": [
      {
        "email_address": "[email protected]",
        "id_from_network": "1231",
        "first_name": "User",
        "phone_number": "805‐708‐9876",
        "last_name": "Affiliate",
        "role": "Super"
      }
    ],
    "status": "Approved"
  }
]

Examples

Read a specific affiliate

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates/222.json

Response Body:

{
  "id_from_network": "222",
  "sites": [
    {
      "id_from_network": "33567",
      "name": "http://www.surfoz.au"
    },
    {
      "id_from_network": "44920",
      "name": "http://www.blogspot.com/surfoz"
    }
  ],
  "name": "Surf Oz Magazine",
  "users": [
    {
      "email_address": "[email protected]",
      "id_from_network": "1231",
      "first_name": "User",
      "phone_number": "805‐708‐9876",
      "last_name": "Affiliate",
      "role": "Super"
    }
  ],
  "status": "Approved"
}

Examples

Delete a single affiliate

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates/222.json

Response Body:

{
}

Examples

Create an affiliate with users

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates/222.json

Format: application/json

Request Body:

{
  "name": "Surf Oz Magazine",
  "status": "Approved",
  "users": [
    {
      "phone_number": "805‐708‐9876",
      "id_from_network": 123,
      "role": "Super",
      "last_name": "Affiliate",
      "first_name": "User",
      "email_address": "[email protected]"
    }
  ],
  "sites": [
    {
      "id_from_network": 33567,
      "name": "http://www.surfoz.au"
    },
    {
      "id_from_network": 44920,
      "name": "http://www.blogspot.com/surfoz"
    }
  ]
}

Response Body:

{
}

Examples

Update a single affiliate

Endpoint:

https://invoca.net/api/2016-05-01/<network_id>/affiliates/222.json

Request Body:

{
  "name": "Updated Surf Oz Magazine"
}