"docs.beeswax.com" has a new address: "api-docs.freewheel.tv/beeswax." Please update your bookmarks accordingly.

POST-ing to Creating Objects

Using the POST request you can create objects using the Buzz API. Buzz will automatically restrict you to objects in your Account and for which you have permission to write. POST requests will be validated for presence of required fields, field validity, referential integrity, etc.

Most problems that occur when POSTing are the result of missing fields or field validation, so make sure to read the error messages if your API call is failing.

Example POSTs

Some examples of both successful and unsuccessful POST requests:

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"advertiser_name":"", "active":1}'

UNSUCCESSFUL: advertiser_name cannot be blank

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"advertiser_name":"advertiser", "active":"foo"}'

UNSUCCESSFUL: active must be an integer

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"advertiser_name":"advertiser", "active":1}'


Example POST Response

After a successful POST, the Buzz API response will include a success message along with the ID of the object created:

    "success": true,
    "message": "advertiser created with ID = 36",
    "payload": {
        "id": 36

Duplicating Existing Objects Using POST

To duplicate an existing object include the special duplicate_object_id parameter in the POST. For example, to duplicate advertiser 123, you can POST the following:

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"duplicate_object_id":123}'

You can selectively overwrite existing fields in the duplicate. For example, to create a new notes field in the copied advertiser:

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"duplicate_object_id":123,"notes":"This is a copy!"}'

Finally, you can also indicate which dependent objects to duplicate recursively. For example, when duplicating an advertiser you may also wish to duplicate all campaigns and line_items belonging to that advertiser. To accomplish this, use the duplicate_objects list in your request:

curl -X POST "[host]/rest/advertiser" -b cookies.txt -d '{"duplicate_object_id":123,"duplicate_objects":["campaign","line_item"]}'

Notes on object duplication:

  • Some objects may not be duplicated. For example Accounts.
  • Some fields may change value when duplicated. For example, the duplicate versions of active line_items are set to inactive to avoid accidentally running and spending money.