Agencies

Manage agency entities used to group advertisers under a common representative

Agencies

Agencies represent advertising agencies that manage campaigns on behalf of one or more advertisers.

Overview

An Agency entity contains:

  • Identification - Name, description
  • Provider Mappings - Identifiers linking the agency to external systems (e.g. a CRM)

Query Agencies

Basic Query

query GetAgencies {
  dream_adserver {
    agencies(limit: 10) {
      edges {
        agency_id
        agency_name
        agency_desc
      }
      total_count
    }
  }
}

Filtered Query

query GetFilteredAgencies($filter: JSON, $sort: JSON) {
  dream_adserver {
    agencies(
      filter: $filter
      sort: $sort
      limit: 25
      offset: 0
    ) {
      edges {
        agency_id
        agency_name
        agency_desc
        agency_ext_id
        agency_ext_ids
        agency_modification_time
        agency_modification_user
      }
      total_count
    }
  }
}

Variables:

{
  "filter": {
    "agency_name": {"like": "%Media%"}
  },
  "sort": {
    "agency_name": "asc"
  }
}

Available Fields

FieldTypeDescription
agency_idInt!Unique identifier
agency_nameString!Agency name
agency_descStringDescriptive information about the agency
agency_ext_idStringAgency identifier in an external database
agency_ext_idsJSONJSON string containing pairs of data sources and IDs
agency_modification_timeStringTime of last modification of agency data (format: yyyy-mm-ddThh:mm:ss.s+zzzzzz)
agency_modification_userStringLogin of the user who last modified the agency data

Mutations

Create/Update Agency

mutation SetAgency($agency: DASAgencyInput!) {
  dream_adserver {
    set_agency(agency: $agency) {
      hit {
        agency_id
        agency_name
      }
    }
  }
}

Variables (create):

{
  "agency": {
    "agency_name": "Example Media Agency",
    "agency_desc": "Full-service media buying agency",
    "agency_provider_mappings": [
      { "provider_name": "CRM", "external_id": "AGY-4821" }
    ]
  }
}

Variables (edit an existing agency — pass agency_id):

{
  "agency": {
    "agency_id": 501,
    "agency_name": "Example Media Agency",
    "agency_provider_mappings": [
      { "provider_name": "CRM", "external_id": "AGY-4821" }
    ]
  }
}
ℹ️

Required field: agency_name. Omit agency_id to create a new agency, provide it to edit an existing one. agency_provider_mappings is the full desired set of external-system mappings, reconciled on every call (add/update/remove) — an empty list clears all mappings, omitting the field leaves existing mappings untouched. The mutation returns hit, the saved DASAgency object.

Next Steps

Related