Skip to content

Bulk Create or Update Deal

Request

Bulk Create/Update Deal endpoint is /deals/v1.0/bulk/deals To create a deal you need to populate all the fileds. To update you need to provide the "id" field and only the fields that you want to change.

Security
Bearer
Headers
Authorizationstring

Authorization

Default:"Bearer $TOKEN"
Bodyapplication/json
{
    "deals": 
    [
        {
            "owner": {
                "type": "ORGANIZATION",
                "id": 100315
            },
            "price_method": "CPM",
            "deal_identifier": "Test_3",
            "name": "Test_3",
            "status": true,
            "start_datetime": "2022-06-01T05:00:00+00:00",
            "end_datetime": "2022-06-17T05:00:00+00:00",
            "channels": [1],
            "supply_source_id": 246,
            "permissions": {
                "organization_ids": [100315],
                "agency_ids" :[],
                "advertiser_ids":[]
            },
            "price": {
                "value": "1.3",
                "currency_code": "EUR"
            },
            "deal_type": "PG",
            "price_type": "FIXED"
        }
    ]
}

for update:

{
    "deals": 
    [
        {
            "id": 457001,
            "name": "Test_3_update",
            "status": false
        }
    ]
}
object
curl -i -X POST \
  https://api.mediamath.com/deals/v1.0/bulk/deals \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{}'

Responses

{
    "data": {
        "valid_deals": [
            {
                "updated_on": "2022-06-28T10:11:37+00:00",
                "created_on": "2022-06-28T10:11:37+00:00",
                "id": 457001,
                "name": "Test_3",
                "description": null,
                "supply_source_id": 246,
                "sub_supply_source_id": null,
                "deal_identifier": "Test_3",
                "start_datetime": "2022-06-01T05:00:00+00:00",
                "end_datetime": "2022-06-17T05:00:00+00:00",
                "price_type": "FIXED",
                "price_method": "CPM",
                "status": true,
                "deal_type": "PG",
                "impressions": null,
                "channels": [
                    {
                        "id": 1,
                        "name": "Display",
                        "pos": 1,
                        "created_on": "2020-07-20T11:13:55.015407+00:00",
                        "updated_on": "2020-07-20T11:13:55.015407+00:00"
                    }
                ],
                "publisher_id": null,
                "strategies_count": 0,
                "organization_id": 100315,
                "effective_status": "creating",
                "severity": null,
                "api_version": "v2",
                "permissions": {
                    "all_organizations": false,
                    "organization_ids": [
                        100315
                    ],
                    "agency_ids": [],
                    "advertiser_ids": []
                },
                "owner": {
                    "type": "ORGANIZATION",
                    "id": 100315
                },
                "price": {
                    "value": "1.3000",
                    "currency_code": "EUR"
                },
                "entity_type": "deal",
                "deal_groups": [],
                "publisher": null
            }
        ],
        "invalid_deals": []
    },
    "meta": {
        "status": "ok"
    }
}

for update:

    "data": {
        "valid_deals": [
            {
                "updated_on": "2022-06-28T12:21:03+00:00",
                "created_on": "2022-06-28T12:20:05+00:00",
                "id": 457226,
                "name": "Test_DanTest_1_update",
                "description": null,
                "supply_source_id": 246,
                "sub_supply_source_id": null,
                "deal_identifier": "Test_DanTest_1",
                "start_datetime": "2022-06-01T05:00:00+00:00",
                "end_datetime": "2022-06-17T05:00:00+00:00",
                "price_type": "FIXED",
                "price_method": "CPM",
                "status": false,
                "deal_type": "PG",
                "impressions": null,
                "channels": [
                    {
                        "id": 1,
                        "name": "Display",
                        "pos": 1,
                        "created_on": "2020-07-20T11:13:55.015407+00:00",
                        "updated_on": "2020-07-20T11:13:55.015407+00:00"
                    }
                ],
                "publisher_id": null,
                "strategies_count": 0,
                "organization_id": 100315,
                "effective_status": "creating",
                "severity": null,
                "api_version": "v2",
                "permissions": {
                    "all_organizations": false,
                    "organization_ids": [
                        100315
                    ],
                    "agency_ids": [],
                    "advertiser_ids": []
                },
                "owner": {
                    "type": "ORGANIZATION",
                    "id": 100315
                },
                "price": {
                    "value": "1.3000",
                    "currency_code": "EUR"
                },
                "entity_type": "deal",
                "deal_groups": [],
                "publisher": null
            }
        ],
        "invalid_deals": []
    },
    "meta": {
        "status": "ok"
    }
}
Bodyapplication/json
dataobject
metaobject
Response
{ "data": { "valid_deals": [ … ], "invalid_deals": [ … ] }, "meta": { "status": "string" } }