MOLOCO Cloud Developer Portal

The MOLOCO Cloud Developer Hub

Welcome to the MOLOCO Cloud Developer Hub. You'll find comprehensive guides and documentation to help you start working with MOLOCO Cloud as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    API Reference

Campaign Management API

What is the MOLOCO Cloud Campaign Management API

MOLOCO Cloud Campaign Management API provides customers with the comprehensive set of APIs for creating and managing MOLOCO Cloud campaigns. It provides Create, Read, Update, Delete and List operations for the following entities:

  • AdAccount
  • Product (App) and TrackingLink
  • Campaign and AdGroup
  • CreativeGroup and Creative
  • CustomTarget
  • CustomerSet

Essential entities for launching a campaign

In order to launch a new campaign, you need to prepare several entities that the campaign depends on. Please see the entity relationship diagram below. If the entity you need is already there, you can reuse it. Otherwise, create a new one. Once you have AdAccount, Product (App), TrackingLink, and CreateGroup entities ready, you can create a new campaign entity.

<Entity relationship diagram><Entity relationship diagram>

Recommended entity preparation order:

  1. Create an AdAccount entity to which the campaign will belong or reuse an existing one.
  2. Create a Product entity that you want to advertise with the new campaign. If you want to advertise an existing product, you can reuse it.
  3. Create or reuse a TrackingLink entity for the Product.
  4. Create one or more Creative entities to expose to the media through the campaign. Each creative asset must be uploaded to public storage before creating a Creative. For user convenience, the feature to upload an asset and create a creative entity at once will be supported soon.
  5. Create one or more CreativeGroup entities to be used with the campaign. Each CreativeGroup entity must refer to one or more Creative entities. You can also reuse existing CreativeGroup and Creative entities.
  6. Create a new Campaign entity and launch it.

Usage example: From scratch to a campaign

1. Creating an AdAccount
Create a new AdAccount entity, the first entity in the order recommended above.
For a detailed description of AdAccount entity creation, see Create a new ad account.

$ cat ad_account.json
{
  "title": "Ad Account For Tutorial",
  "description": "Ad Account For Tutorial",
  "timezone": "America/Los_Angeles",
  "currency": "USD"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@ad_account.json" \
  "https://api.moloco.cloud/cm/v1/ad-accounts"

{
  "ad_account": {
    "id": "$AD_ACCOUNT_ID",
    "title": "Ad Account For Tutorial",
    "description": "Ad Account For Tutorial",
    "timezone": "America/Los_Angeles",
    "currency": "USD",
    "created_at": "2020-07-01T00:00:17.317689Z",
    "updated_at": "2020-07-01T00:00:17.317689Z"
  }
}

In this example, your parameters for a new AdAccount creation request are in the ad_account.json file and delivered to the Campaign Management API as an HTTP POST request body.

In the request response, you can find various information such as the AdAccount ID ($AD_ACCOUNT_ID) assigned to the newly created AdAccount, as well as the fields that were included in the request.

About the $TOKEN, please see the "Getting Started with Cloud API". In the "Prerequisite" section, you can find the information to issue a $TOKEN for the MOLOCO Cloud authentication.

2. Creating a Product (App)
Next you will need to create a new Product entity. At this stage, you need the AdAccount ID that was created in the previous step. In MOLOCO Cloud Campaign Management API, App and Web are managed as an entity called Product.

For a detailed description of Product entity creation, see Create a new product.

$ cat product.json
{
  "title": "Tutorial App",
  "advertiser_domain": "molocoads.com",
  "device_os": "ANDROID",
  "type": "APP",
  "app": {
    "bundle_id": "com.moloco.ads",
    "category": "IAB9-1",
    "rating": 5,
    "app_store_url": "https://play.google.com/store/apps/details?id=com.moloco.ads",
    "postback_integration": {
      "mmp": "TRACKFNT",
      "bundle_id": "com.moloco.ads"
    }
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@product.json" \
  "https://api.moloco.cloud/cm/v1/products?ad_account_id=$AD_ACCOUNT_ID"

{
  "product": {
    "ad_account_id": "$AD_ACCOUNT_ID",
    "id": "$PRODUCT_ID",
    "title": "Tutorial App",
    "advertiser_domain": "molocoads.com",
    "device_os": "ANDROID",
    "type": "APP",
    "app": {
      "bundle_id": "com.moloco.ads",
      "category": "IAB9-1",
      "rating": 5.0,
      "app_store_url": "https://play.google.com/store/apps/details?id=com.moloco.ads",
      "tracking_company": "ADJUST",
      "tracking_bundle_id": "com.moloco.ads",
      "postback_integration": {
         "mmp": "TRACKFNT",
         "bundle_id": "com.moloco.ads"
      },
      "mmp_integration": {
         "id": "mAZE5cU0tZl1uIA5",
         "mmp_bundle_id": "com.moloco.ads",
         "mmp": "ADJUST",
         "status": "UNDER_REVIEW",
         "updated_at": "2020-07-01T15:29:45.457575Z"
      }
    },
    "created_at": "2020-07-01T15:29:45.732976Z",
    "updated_at": "2020-07-01T15:29:45.732976Z"
  }
}

In the above example response body, you can find the Product ID ($PRODUCT_ID), which will be used by the other entities below.

3. Creating a TrackingLink
Next, create a TrackingLink entity. TrackingLink is an entity that contains the Tracking Company, CT(Click Through) Link, and VT(View Through) Link. CT Link is a url for notifying the Tracking Company when a click event occurs, and VT Link is for notifying when an impression event occurs. To create a TrackingLink entity, you need to know which Tracking Company your app is using, and you will also need CT Link and VT Link information issued by the Tracking Company.

For a detailed description of TrackingLink entity creation, see Create a new tracking link.

$ cat tracking_link.json
{
  "title": "Tutorial App Tracking Link",
  "description": "Tutorial App Tracking Link",
  "device_os": "ANDROID",
  "click_through_link": {
    "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&mt_ad=%{creative_filename}&mt_ad_id=%{creative_id}&mt_ad_type=%{creative_type}&mt_click_lookback=7d&mt_cost_currency=%{cost_currency}&mt_cost_model=%{cost_type}&mt_cost_value=%{cost_amount}&mt_siteid=%{raw_app_bundle}&mt_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int"
  },
  "view_through_link": {
    "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&mt_ad=%{creative_filename}&mt_ad_id=%{creative_id}&mt_ad_type=%{creative_type}&mt_cost_currency=%{cost_currency}&mt_cost_model=%{cost_type}&mt_cost_value=%{cost_amount}&mt_siteid=%{raw_app_bundle}&mt_sub4=%{source}&mt_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int"
  },
  "tracking_company": "TRACKFNT"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@tracking_link.json" \
  "https://api.moloco.cloud/cm/v1/tracking-links?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "tracking_link": {
    "id": "$TRACKING_LINK_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Tutorial App Tracking Link",
    "description": "Tutorial App Tracking Link",
    "device_os": "ANDROID",
    "click_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_click_lookback=7d&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "view_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&ml_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "tracking_company": "TRACKFNT",
    "created_at": "2020-07-01T09:50:37.924722Z",
    "updated_at": "2020-07-01T09:50:37.924722Z"
  }
}

In the above example response body, you can find the TrackingLink ID ($TRACKING_LINK_ID), which will be used by the CreativeGroup entities.

4. Creating a Creative
Each campaign must have one or more CreativeGroup entities to advertise its app. And each CreativeGroup entity may have multiple Creative entities. It's better to create Creative entities first before creating a CreativeGroup entity. Please notice that you need a url for your creative asset, so it should be uploaded to any publicly accessible storage such as Google Cloud Storage or AWS S3. If you want to use the storage provided by MOLOCO Cloud, follow the step 4-1, otherwise proceed to 4-2.

4-1. Uploading a Creative asset to the storage using MOLOCO Cloud API
To upload a creative asset to a storage, 1) you should get an upload URL for your asset and 2) initiate a resumable upload session by making a call to the upload URL with a POST request, 3) next you can upload the creative asset by making another call to the same URL with a PUT request.

For a detailed description of asset upload session creation, see Create a new asset upload session.

$ cat asset.json
{
  "asset_kind": "CREATIVE",
  "mime_type": "image/jpeg",
  "file_name": "test_image.jpg"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@asset.json" \
  "https://api.moloco.cloud/cm/v1/creative-assets?ad_account_id=$AD_ACCOUNT_ID"

{
  "asset_url": "$CREATIVE_ASSET_URL",
  "content_upload_url": "$UPLOAD_URL"
}

You can find the upload URL ($UPLOAD_URL) in the "content_upload_url" field. Now upload the creative asset to $UPLOAD_URL. MOLOCO Cloud provides Google Cloud Storage for Creative assets, and $UPLOAD_URL points to the URL for Resumable uploads. Initiate a resumable upload session as follows:

$ curl -v -X POST \
  -H "x-goog-resumable: start" \
  -H "Content-Type: image/jpeg" \
  "$UPLOAD_URL" 2>&1 \
  | grep "x-guploader-uploadid"

< x-guploader-uploadid: $UPLOAD_ID

Please check out the upload id ($UPLOAD_ID) at the x-guploader-uploadid field of the response. Using the the upload id, you can upload the asset file to the storage by making a call to the upload URL with a PUT request. But please append a query parameter "upload_id=$UPLOAD_ID" at the end of the URL. $ASSET_PATH is the path where the creative asset to upload is in the following request:

$ curl -X PUT \
  --data-binary "@$ASSET_PATH" \
  -H "Content-Type: image/jpeg" \
  "$UPLOAD_URL&upload_id=$UPLOAD_ID"

Now your creative asset has been uploaded to the storage. You can access it at the URL $CREATIVE_ASSET_URL. Please use this URL in the following step.

4-2. Creating a Creative
If your creative asset is uploaded to a storage and has an accessible URL, create a Creative entity like the following. Let's say your asset's URL is $CREATIVE_ASSET_URL.

For a detailed description of Creative entity creation, see Create a new creative.

$ cat creative.json
{
  "title": "Test Image Creative",
  "type": "IMAGE",
  "original_filename": "test_image.jpg",
  "size_in_bytes": 94994,
  "image": {
    "image_url": "$CREATIVE_ASSET_URL",
    "width": 640,
    "height": 960,
    "size_in_bytes": 94994
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative.json" \
  "https://api.moloco.cloud/cm/v1/creatives?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative": {
    "id": "$CREATIVE_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "title": "Test Image Creative",
    "enabling_state": "ENABLED",
    "ad_account_info": {
      "id": "$AD_ACCOUNT_ID",
      "title": "Ad Account For Tutorial",
      "description": "Ad Account For Tutorial"
    },
    "type": "IMAGE",
    "original_filename": "test_image.jpg",
    "size_in_bytes": 94994,
    "image": {
      "image_url": "$CREATIVE_ASSET_URL",
      "width": 640,
      "height": 960,
      "size_in_bytes": 94994
    },
    "created_at": "2020-07-01T14:54:00.526009Z",
    "updated_at": "2020-07-01T14:54:00.526009Z"
  }
}

In the above example response body, you can find the Creative ID ($CREATIVE_ID), which is required by the CreativeGroup entity.

5. Creating a CreativeGroup
CreativeGroup entities group Creative entities that have a similar appearance to help users easily reference them in campaigns. Create a CreativeGroup entity that references one or more of the pre-created Creative entities. Note that the CreativeGroup entity also refers to the TrackingLink entity.

For a detailed description of CreativeGroup entity creation, see Create a new creative group.

$ cat creative_group.json
{
  "ad_account_id": "$AD_ACCOUNT_ID",
  "product_id": "$PRODUCT_ID",
  "title": "Test CreativeGroup",
  "description": "Test CreativeGroup",
  "enabling_state": "ENABLED",
  "status": "APPROVED",
  "tracking_link_id": "$TRACKING_LINK_ID",
  "creative_ids": [
    "$CREATIVE_ID"
  ]
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@creative_group.json" \
  "https://api.moloco.cloud/cm/v1/creative-groups?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "creative_group": {
    "id": "tla69ad6dz2JAUAY",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test CreativeGroup",
    "description": "Test CreativeGroup",
    "enabling_state": "ENABLED",
    "creative_ids": [
      "$CREATIVE_ID"
    ],
    "status": "APPROVED",
    "action_history": [
      {
        "id": "05fb3aa5-44b9-4943-77c4-90f5f15a31c7",
        "action_type": "CREATE",
        "created_at": "2020-07-01T15:21:05.797660752Z"
      }
    ],
    "tracking_link_id": "$TRACKING_LINK_ID",
    "audience": {},
    "created_at": "2020-07-01T15:21:05.909989Z",
    "updated_at": "2020-07-01T15:21:05.909989Z"
  },
  "creatives": [
    {
      "id": "$CREATIVE_ID",
      "ad_account_id": "$AD_ACCOUNT_ID",
      "title": "Test Image Creative",
      "enabling_state": "ENABLED",
      "ad_account_info": {
        "id": "$AD_ACCOUNT_ID",
        "title": "Ad Account For Tutorial",
        "description": "Ad Account For Tutorial"
      },
      "type": "IMAGE",
      "original_filename": "test_image.jpg",
      "size_in_bytes": 94994,
      "image": {
        "image_url": "$CREATIVE_ASSET_URL",
        "width": 640,
        "height": 960,
        "size_in_bytes": 94994
      },
      "created_at": "2020-07-01T14:54:00.526009Z",
      "updated_at": "2020-07-01T14:54:00.526009Z"
    }
  ],
  "tracking_link": {
    "id": "$TRACKING_LINK_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Tutorial App Tracking Link",
    "description": "Tutorial App Tracking Link",
    "device_os": "ANDROID",
    "click_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_click_lookback=7d&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "view_through_link": {
      "url": "https://tracker-us.adsmoloco.com/com.trackfnt.adNetworkTest?advertising_id=%{a_idfa}&ml_ad=%{creative_filename}&ml_ad_id=%{creative_id}&ml_ad_type=%{creative_type}&ml_cost_currency=%{cost_currency}&ml_cost_model=%{cost_type}&ml_cost_value=%{cost_amount}&ml_siteid=%{raw_app_bundle}&ml_sub4=%{source}&ml_viewthrough_lookback=1d&c=%{campaign}&clickid=%{bid_id}&pid=moloco_int",
      "status": "UNVERIFIED",
      "unverified_status_data": {
        "stored_at": "2020-07-01T09:50:37Z"
      }
    },
    "tracking_company": "TRACKFNT",
    "created_at": "2020-07-01T09:50:37.924722Z",
    "updated_at": "2020-07-01T09:50:37.924722Z"
  }
}

In the above example response body, you can find the CreativeGroup ID ($CREATIVE_GROUP_ID), which is required by the following entities. Also, for the user's convenience, the contents of Creative and TrackingLink referenced by CreativeGroup are embedded.

6. Creating a Campaign
Now, it's time to create a Campaign entity using the entities created above.

For a detailed description of Campaign entity creation, see Create a new campaign.

$ cat campaign.json
{
  "campaign": {
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Campaign",
    "description": "Test Campaign",
    "enabling_state": "ENABLED",
    "type": "APP_USER_ACQUISITION",
    "device_os": "ANDROID",
    "country": "KOR",
    "currency": "USD",
    "schedule": {
      "start": "2020-07-01T07:00:00Z"
    },
    "budget_schedule": {
      "daily_budget": {
        "daily_budget": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "tracking_company": "TRACKFNT",
    "goal": {
      "type": "OPTIMIZE_CPI_FOR_APP_UA",
      "optimize_app_installs": {
        "mode": "TARGET_CPI_CENTRIC",
        "target_cpi": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    }
  },
  "ad_group": {
    "title": "Test AdGroup",
    "enabling_state": "ENABLED",
    "audience": {},
    "capper": {
      "imp_interval": {
        "amount": "12",
        "unit": "HOUR"
      }
    },
    "creative_group_ids": [
      "$CREATIVE_GROUP_ID"
    ]
  }
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@campaign.json" \
  "https://api.moloco.cloud/cm/v1/campaigns?ad_account_id=$AD_ACCOUNT_ID&product_id=$PRODUCT_ID"

{
  "campaign": {
    "id": "$CAMPAIGN_ID",
    "ad_account_id": "$AD_ACCOUNT_ID",
    "product_id": "$PRODUCT_ID",
    "title": "Test Campaign",
    "description": "Test Campaign",
    "enabling_state": "ENABLED",
    "type": "APP_USER_ACQUISITION",
    "device_os": "ANDROID",
    "state": "SUBMITTED",
    "country": "KOR",
    "currency": "USD",
    "schedule": {
      "start": "2020-07-01T07:00:00Z"
    },
    "budget_schedule": {
      "daily_budget": {
        "daily_budget": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "audience": {
      "shared_audience_target_ids": [],
      "targeting_condition": {
        "allowed_exchanges": [
          "ADX",
          "MOPUB",
          "UNITY"
        ]
      }
    },
    "tracking_company": "TRACKFNT",
    "goal": {
      "type": "OPTIMIZE_APP_INSTALLS",
      "optimize_app_installs": {
        "mode": "TARGET_CPI_CENTRIC",
        "target_cpi": {
          "currency": "USD",
          "amount_micros": "1000000"
        }
      }
    },
    "created_at": "2020-07-01T15:34:43.323228Z",
    "updated_at": "2020-07-01T15:34:43.323228Z"
  }
}

Right after creating a Campaign entity, the campaign's state is "SUBMITTED". After a certain period of time (approximately 2 hours), when the ML Model for the campaign is ready, the state changes to "ACTIVE", which indicates that the campaign can participate in bidding.

Finally, you are ready to launch a new campaign. Once the campaign's state became "ACTIVE" automatically, the creatives you set up will be live via MOLOCO Cloud. If you want to evaluate the performance after the campaign has been launched, you can check out the details through the Report API and Log API.

Usage example: Create a CustomerSet

1. Creating a CustomerSet
CustomerSet is an entity representing a set of customer IDFAs. This can be used to target or detarget specific customer groups. To create a CustomerSet, you need to upload a csv file containing customer IDFAs, which is basically similar to the Creative creation process.
Please notice that you need a url for your CustomerSet asset, and it should be uploaded to the Google Cloud Storage. Unlike creating Creatives, CustomerSet assets must be uploaded to the GCS, so 1-1 cannot be skipped.

1-1. Uploading a CustomerSet asset to the storage using MOLOCO Cloud API
To upload a CustomerSet asset to a storage, 1) you should get an upload URL for your asset and 2) initiate a resumable upload session by making a call to the upload URL with a POST request, 3) next you can upload the CustomerSet asset by making another call to the same URL with a PUT request.

For a detailed description of asset upload session creation, see Create a new asset upload session.

$ cat asset.json
{
  "asset_kind": "CSV",
  "mime_type": "test/csv",
  "file_name": "test_customer_set.csv"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@asset.json" \
  "https://api.moloco.cloud/cm/v1/creative-assets?ad_account_id=$AD_ACCOUNT_ID"

{
  "asset_url": "$CUSTOMER_SET_ASSET_URL",
  "content_upload_url": "$UPLOAD_URL"
}

You can find the upload URL ($UPLOAD_URL) in the "content_upload_url" field. Now upload the CustomerSet asset to $UPLOAD_URL. MOLOCO Cloud provides Google Cloud Storage for CustomerSet assets, and $UPLOAD_URL points to the URL for Resumable uploads. Initiate a resumable upload session as follows:

$ curl -v -X POST \
  -H "x-goog-resumable: start" \
  -H "Content-Type: text/csv" \
  "$UPLOAD_URL" 2>&1 \
  | grep "x-guploader-uploadid"

< x-guploader-uploadid: $UPLOAD_ID

Please check out the upload id ($UPLOAD_ID) at the x-guploader-uploadid field of the response. Using the the upload id, you can upload the asset file to the storage by making a call to the upload URL with a PUT request. But please append a query parameter "upload_id=$UPLOAD_ID" at the end of the URL. $ASSET_PATH is the path where the CustomerSet asset to be uploaded in the following request is located:

$ curl -i -X PUT \
  --data-binary "@$ASSET_PATH" \
  -H "Content-Type: text/csv" \
  -H "Connection: keep-alive" \
  "$UPLOAD_URL&upload_id=$UPLOAD_ID"

If you see HTTP 200 OK or 201 in the response message, it indicates that the upload is completed.
Now your CustomerSet asset has been uploaded to the storage. You can access it at the URL $CUSTOMER_SET_ASSET_URL. Please use this URL in the following step.

📘

Checking the integrity of the uploaded file

If you want to check the integrity of the uploaded file, use the following request:

$ curl -i -X PUT \
    -H "Content-Length: 0" \
    -H "Content-Range: bytes */*" \
    "$UPLOAD_URL&upload_id=$UPLOAD_ID" 2>&1 \
    | grep "x-goog-hash\|HTTP\|x-goog-stored-content-encoding"

HTTP/2 200
x-goog-hash: crc32c=$GOOG_CRC32C
x-goog-hash: md5=$GOOG_HASH
x-goog-stored-content-encoding: identity

If your local machine has gsutil installed, then you can verify integrity by comparing $GOOG_HASH and $FILE_HASH.

$ gsutil -m $ASSET_PATH

Hashes [base64] for $ASSET_PATH:
Hash (md5): $FILE_HASH

1-2. Creating a CustomerSet
If your CustomerSet asset is uploaded to the GCS and has an accessible URL, create a CustomerSet entity like the following. Let's say your asset's URL is $CUSTOMER_SET_ASSET_URL.

You can set GOOGLE_ADID or APPLE_IDFA in the id_type field, which means Google's ADID and Apple's IDFA, respectively. You cannot mix ADID and IDFA in one CustomerSet.
For a detailed description of CustomerSet entity creation, see Create a new customer set.

$ cat customer_set.json
{
  "title": "Test CustomerSet",
  "description": "Test CustomerSet",
  "id_type": "GOOGLE_ADID",
  "data_file_path": "$CUSTOMER_SET_ASSET_URL"
}

$ curl -X POST \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "@customer_set.json" \
  "https://api.moloco.cloud/cm/v1/customer-sets?ad_account_id=$AD_ACCOUNT_ID"

{
  "customer_set": {
    "id": "$CUSTOMER_SET_ID",
    "title": "Test CustomerSet",
    "description": "Test CustomerSet",
    "id_type": "GOOGLE_ADID",
    "status": "PREPARING",
    "data_file_path": "$CUSTOMER_SET_ASSET_URL",
    "created_at": "2020-07-01T15:34:43.323228Z",
    "updated_at": "2020-07-01T15:34:43.323228Z"
  }
}

In the above example response body, you can find the CustomerSet ID ($CUSTOMER_SET_ID), which can be used by AudienceTarget. See Create a new audience target.

Updated 10 months ago

Campaign Management API


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.