Batch Queries

The Octopus API supports batch queries, which allow multiple payloads to be sent within a single request. This feature is available for all basic operations: Read, Create, Update, and Delete.

Naming Convention

To perform batch queries, the objects in the payload must follow this naming pattern:

<object-name>.<alias> {
    ... payload ...
},
<object-name>.<alias> {
    ... payload ...
},
<object-name>.<alias> {
    ... payload ...
}

Examples:

  • AbEntry.Individual
    • Object: AbEntry\

    • Alias: Individual\

  • Opportunity.Won
    • Object: Opportunity\

    • Alias: Won\

  • Lead.AnyValue
    • Object: Lead\

    • Alias: AnyValue\

Key Guidelines

  1. For all Operations:

    1. The object name must be valid and supported by Octopus API.
    2. The alias must be unique within the payload; the same object cannot have duplicate aliases.
  2. Read Operations:

    1. Any object and criteria can be used
    2. If an error occurs during the processing of any batch, the entire process is aborted, and an error is returned. In such cases, the API does not return any success responses for the completed operations. For example, if a request contains 10 queries and the last query fails, the API response will include only the error message for the last operation. The results of the other 9 successfully executed queries will not be included in the response.
  3. Create, Update, and Delete Operations:

    1. Each operation is processed as a single-record operation:

      1. Create: Generates one key per operation.
      2. Update/Delete: Requires one key as a mandatory field.
    2. The payload must adhere to the object’s schema and constraints.

    3. As each batch is isolated, it is not possible to reference data from previous batches. For example, you might consider creating a new Company and then using the dynamically generated company key to create Contacts within the same payload. However, this is not supported, as there is no way to reference the generated company key in the contact payload.

Execution Behavior

  • The Octopus API processes batch payloads sequentially, one record at a time.\

  • Each operation is independent, meaning that if an error occurs, the execution halts immediately, and subsequent operations are not executed.\

Transaction Isolation

  • Transactions are isolated per operation:
    • Once a batch is successfully processed, its transaction is committed.\

    • If a failure occurs in a subsequent batch, only that specific batch is rolled back. Previously committed transactions remain unaffected.

Read

Batch Read

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    // Get top 3 Companies
    "AbEntry.Companies": {
        "Scope": {
            "Fields": {
                "DisplayValue": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Type": {
                    "$EQ": "Company"
                }
            },
            "Top": 3
        }
    },
    // Get top 3 Individuals
    "AbEntry.Individuals": {
        "Scope": {
            "Fields": {
                "DisplayValue": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Type": {
                    "$EQ": "Individual"
                }
            },
            "Top": 3
        }
    },
    // Get top 3 Won Opportunities
    "Opportunity.Won": {
        "Scope": {
            "Fields": {
                "DisplayValue": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Status": {
                    "$EQ": 3 // Won
                }
            },
            "Top": 3
        }
    },
    "Compatibility": {
        "AbEntryKey": "2.0"
    },
    "Configuration": {
        "Drivers": {
            "IAbEntrySearcher": "Maximizer.Model.Access.Sql.AbEntrySearcher",
            "IOpportunitySearcher": "Maximizer.Model.Access.Sql.OpportunitySearcher"
        }
    }
}

Create

Batch Create

// POST https://api.maximizer.com/octopus/Create
// Authorization: Bearer <token>
{
    "AbEntry.1": {
        "Data": {
            "Key": null,
            "Type": "Company", // mandatory
            "CompanyName": "My Test Company", // mandatory for Type = Company
            "Address": {
                "AddressLine1": "1234 Main St.",
                "City": "Anytown",
                "StateProvince": "BC",
                "ZipCode": "12345",
                "Country": "CAN"
            }
        }
    },
    "AbEntry.2": {
        "Data": {
            "Key": null,
            "Type": "Individual", // mandatory
            "LastName": "My Individual LastName", // mandatory for Type = Individual
            "Address": {
                "AddressLine1": "1234 Main St.",
                "City": "Anytown",
                "StateProvince": "BC",
                "ZipCode": "12345",
                "Country": "CAN"
            }
        }
    },
    "Opportunity.1": {
        "Data": {
            "Key": null,
            "AbEntryKey": "QWJFbnRyeQkyMjA1MDUyNTE1MzY1OTg0NTAwMDVDCTA=", // mandatory
            "Objective": "My Test Objective" // mandatory
        }
    },
    "Compatibility": {
        "AbEntryKey": "2.0"
    }
}

Update

Batch Update

// POST https://api.maximizer.com/octopus/Update
// Authorization: Bearer <token>
{
    "AbEntry.1": {
        "Data": {
            "Key": "Q29tcGFueQkyNTAxMDkyNTEyNDUxNzc4OTAwMDdDCTA=", // mandatory
            "CompanyName": "My Test Company UPDATED 3"
        }
    },
    "AbEntry.2": {
        "Data": {
            "Key": "SW5kaXZpZHVhbAkyNTAxMDkyNTEyNDUxODY3NzAwMDhDCTA=", // mandatory
            "LastName": "My Individual LastName UPDATED 3"
        }
    },
    "Opportunity.1": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjUwMTA5MjUxMjQ1MTk3NzgwMDA5Twkw", // mandatory
            "Objective": "My Test Objective UPDATED"
        }
    },
    "Compatibility": {
        "AbEntryKey": "2.0"
    }
}

Delete

Batch Delete

// POST https://api.maximizer.com/octopus/Delete
// Authorization: Bearer <token>
{
    "AbEntry.1": {
        "Data": {
            "Key": "Q29tcGFueQkyNTAxMDkyNTExNDE0Njc5MzAwMDRDCTA=" // mandatory
        }
    },
    "AbEntry.2": {
        "Data": {
            "Key": "SW5kaXZpZHVhbAkyNTAxMDkyNTEyNDUxODY3NzAwMDhDCTA=" // mandatory
        }
    },
    "Opportunity.1": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjUwMTA5MjUxMTQxNDk3NzMwMDA2Twkw" // mandatory
        }
    },
    "Compatibility": {
        "AbEntryKey": "2.0"
    }
}