The 4 critical errors developers make with the ADP API and how to avoid them
Common Mistakes
Learn the 4 CRITICAL errors that trip up developers when integrating with the ADP API - and how to avoid them.
**⚠️ Success Rate**: Only ~60% of developers get these right on first attempt. Reading this guide will put you in the top 40%!Error #1: Uppercase Sort Directions (CRITICAL)
Severity: 🔴 CRITICAL - Causes immediate validation error
Frequency: 40% of developers make this mistake
❌ WRONG
{
"sort": {
"lineitem_id": "DESC"
}
}
Error Message:
{
"errors": [
{
"message": "Invalid sort direction. Must be 'asc' or 'desc' (lowercase)"
}
]
}
✅ CORRECT
{
"sort": {
"lineitem_id": "desc"
}
}
Why This Happens
Most GraphQL APIs and SQL databases accept uppercase ASC/DESC. The ADP API is different - it strictly requires lowercase.
How to Avoid
- Always lowercase: Use
"asc"and"desc"exclusively - Code review: Check for uppercase in pull requests
- Linting: Add rules to catch uppercase sort directions
- Testing: Test both directions in integration tests
Error #2: Using node Wrapper in Connections (HIGH)
node Wrapper in Connections (HIGH)Severity: 🟠 HIGH - Query fails to return data
Frequency: 35% of developers make this mistake
❌ WRONG
query {
dream_adserver {
lineitems(limit: 10) {
edges { # ← WRONG: node wrapper not used
lineitem_id
lineitem_name
}
}
}
}
Error Message:
{
"errors": [
{
"message": "Cannot query field 'node' on type 'DASLineitem'"
}
]
}
✅ CORRECT
query {
dream_adserver {
lineitems(limit: 10) {
edges { # ← CORRECT: direct access
lineitem_id
lineitem_name
}
total_count
}
}
}
Why This Happens
Standard GraphQL Relay connections use edges { ... }. The ADP API uses a custom Connection structure without the node wrapper.
Connection Structure Comparison
| Feature | Standard GraphQL | ADP API |
|---|---|---|
| Items array | edges | edges ✅ |
| Item wrapper | edges { ... } | edges { ... } ✅ NO WRAPPER |
| Count field | pageInfo.totalCount | total_count ✅ |
| Naming | camelCase | snake_case ✅ |
How to Avoid
- No node wrapper: Access fields directly in
edges - Use total_count: Not
totalCountorpageInfo - Snake case: All field names use
snake_case
Error #3: Inline JSON in GraphQL (CRITICAL)
Severity: 🔴 CRITICAL - Query syntax error
Frequency: 25% of developers make this mistake
❌ WRONG
query {
dream_adserver {
lineitems(
filter: $filter} # ← WRONG: inline JSON
) {
edges {
lineitem_id
}
}
}
}
Error Message:
{
"errors": [
{
"message": "Syntax Error: Expected Name, found {",
"locations": [{"line": 3, "column": 15}]
}
]
}
✅ CORRECT
query GetLineitems($filter: JSON) {
dream_adserver {
lineitems(filter: $filter) {
edges {
lineitem_id
lineitem_name
}
}
}
}
Variables:
{
"filter": {
"lineitem_type": {"=": "DISPLAY"}
}
}
Why This Happens
GraphQL does not support inline JSON syntax. All JSON-type parameters (filter, sort) must be passed as variables.
How to Avoid
- Always use variables: For
filter,sort, and any JSON parameter - Define variable types:
$filter: JSON,$sort: JSON - Pass in variables object: Separate from query
Complete Example
Query:
query GetFilteredLineitems($filter: JSON, $sort: JSON, $limit: Int) {
dream_adserver {
lineitems(
filter: $filter
sort: $sort
limit: $limit
) {
edges {
lineitem_id
lineitem_name
lineitem_type
}
total_count
}
}
}
Variables:
{
"filter": {
"lineitem_type": {"=": "DISPLAY"},
"lineitem_is_archived": {"=": false}
},
"sort": {
"lineitem_id": "desc"
},
"limit": 10
}
Error #4: Missing Domain Root Field (CRITICAL)
Severity: 🔴 CRITICAL - Query completely fails
Frequency: 20% of developers make this mistake
❌ WRONG
query {
lineitems(limit: 10) { # ← WRONG: missing domain wrapper
edges {
lineitem_id
}
}
}
Error Message:
{
"errors": [
{
"message": "Cannot query field 'lineitems' on type 'Query'"
}
]
}
✅ CORRECT
query {
dream_adserver { # ← CORRECT: wrapped in domain
lineitems(limit: 10) {
edges {
lineitem_id
lineitem_name
}
}
}
}
Why This Happens
The ADP API uses domain-based organization with 8 root fields. All operations must be wrapped in the appropriate domain.
Domain Root Fields
| Root Field | Use For |
|---|---|
dream_adserver | Deals, Line Items, Creatives, Advertisers |
report | Report tasks, report queries |
inventory_manager | Ad units, placements, targeting |
dream_audience | Audience segments, databases |
user_manager | User management |
video | Video ad operations |
crm | CRM integration |
mia | Media analytics |
How to Avoid
- Always wrap queries: Use appropriate domain root field
- Check schema: In Playground, see which domain each operation belongs to
- Follow examples: All documentation examples show correct structure
Additional Common Mistakes
Mistake #5: Direct Filter Values
❌ WRONG:
{
"filter": {
"lineitem_type": "DISPLAY" # ← Missing operator
}
}
✅ CORRECT:
{
"filter": {
"lineitem_type": {"=": "DISPLAY"} # ← Operator-based
}
}
See Filtering for details.
Mistake #6: String Boolean Values
❌ WRONG:
{
"filter": {
"lineitem_is_archived": {"=": "false"} # ← String
}
}
✅ CORRECT:
{
"filter": {
"lineitem_is_archived": {"=": false} # ← Boolean literal
}
}
Mistake #7: Using hit Instead of edges
hit Instead of edges❌ WRONG:
lineitems {
hit { # ← Wrong array field name
lineitem_id
}
}
✅ CORRECT:
lineitems {
edges { # ← Correct array field name
lineitem_id
}
}
Mistake #8: camelCase Field Names
❌ WRONG:
lineitems {
edges {
lineitemId # ← camelCase
lineitemName
}
}
✅ CORRECT:
lineitems {
edges {
lineitem_id # ← snake_case
lineitem_name
}
}
Quick Reference Checklist
Before submitting your first API call, verify:
- ✅ Sort directions are lowercase (
"asc","desc") - ✅ No
nodewrapper in Connections (direct access inedges) - ✅ JSON parameters use GraphQL variables (not inline)
- ✅ Queries wrapped in domain root field (
dream_adserver,report, etc.) - ✅ Filters use operator syntax (
{"=": value}) - ✅ Boolean values are literals (
true/false, not strings) - ✅ Array field is
edges(nothitornodes) - ✅ Field names use snake_case (not camelCase)
Error Prevention Tools
1. Use the Playground
Test queries in the Playground before coding:
https://adp-api.dreamlab.pl/playground
- Auto-complete: Shows available fields
- Validation: Catches errors before execution
- Schema docs: Browse correct field names
2. Code Templates
Use these templates to start correctly:
Basic Query Template:
query GetData($filter: JSON, $sort: JSON, $limit: Int, $offset: Int) {
dream_adserver {
[OPERATION](
filter: $filter
sort: $sort
limit: $limit
offset: $offset
) {
edges {
[FIELDS]
}
total_count
}
}
}
Variables Template:
{
"filter": {
"[field]": {"=": "[value]"}
},
"sort": {
"[field]": "desc"
},
"limit": 10,
"offset": 0
}
3. Validation Checklist
Before deploying:
- Test with Playground
- Verify all 4 critical patterns
- Check error handling
- Test with real data (Demo Network: 7012768)
- Code review by another developer
Impact on Success Metrics
Avoiding these mistakes directly impacts your integration success:
| Metric | With Mistakes | Without Mistakes |
|---|---|---|
| First API call time | 30+ minutes | <10 minutes ✅ |
| Error rate | 60% | <5% ✅ |
| Support tickets | High | Low ✅ |
| Integration time | Days | Hours ✅ |
Following this guide gets you there!
Next Steps
Now that you know what to avoid:
- Explore Delivery APIs - Manage campaigns confidently
- Review Field References - Master filtering, sorting, pagination
- Query Line Items - Start with real operations
- Learn Reporting - Generate campaign reports
Need Help?
If you encounter errors:
- Check this guide first
- Test in Playground to isolate issue
- Review GraphQL Overview
- Contact
[email protected]
Remember: 95% of integration errors are caused by these 4 mistakes. Master them and you'll integrate successfully!
