Skip to content

Instantly share code, notes, and snippets.

@saas-coder
Last active February 17, 2025 22:30
Show Gist options
  • Select an option

  • Save saas-coder/e208ac5b3cca35ecb7f33586571ee986 to your computer and use it in GitHub Desktop.

Select an option

Save saas-coder/e208ac5b3cca35ecb7f33586571ee986 to your computer and use it in GitHub Desktop.

Complete Example Structure

1. Create Main Marketing Folder

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Marketing Campaigns 2024"
  }'
# Response: {"success": true, "data": {"id": "mc_root", "path": "folders/mc_root"}}

2. Create Q1 Subfolder

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Q1 Campaigns",
    "parent_path": "folders/mc_root"
  }'
# Response: {"success": true, "data": {"id": "q1_folder", "path": "folders/mc_root/subfolders/q1_folder"}}

3. Create Product Lines Subfolder (Depth 2)

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Product Lines",
    "parent_path": "folders/mc_root/subfolders/q1_folder"
  }'
# Response: {"success": true, "data": {"id": "products_folder", "path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder"}}

4. Create Electronics Category (Depth 3)

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Electronics",
    "parent_path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder"
  }'
# Response: {"success": true, "data": {"id": "electronics_folder", "path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder/subfolders/electronics_folder"}}

5. Create Smartphones Category (Depth 4)

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Smartphones",
    "parent_path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder/subfolders/electronics_folder"
  }'
# Response: {"success": true, "data": {"id": "smartphones_folder", "path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder/subfolders/electronics_folder/subfolders/smartphones_folder"}}

6. Create Boards in Different Folders

6.1 Main Marketing Board

curl -X POST "https://mongo.fillcreative.io/api/boards/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Overall Strategy 2024",
    "description": "Main marketing strategy and goals for 2024",
    "folder_path": "folders/mc_root"
  }'
# Response: {"success": true, "data": {"id": "strategy_board"}}

6.2 Q1 Campaign Board

curl -X POST "https://mongo.fillcreative.io/api/boards/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Q1 Launch Campaign",
    "description": "New product launch campaign for Q1",
    "folder_path": "folders/mc_root/subfolders/q1_folder"
  }'
# Response: {"success": true, "data": {"id": "q1_board"}}

6.3 Electronics Campaign Board

curl -X POST "https://mongo.fillcreative.io/api/boards/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Electronics Promotion",
    "description": "Special deals and promotions for electronics",
    "folder_path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder/subfolders/electronics_folder"
  }'
# Response: {"success": true, "data": {"id": "electronics_board"}}

7. Add Ads to Boards

7.1 Add Ads to Main Strategy Board

curl -X POST "https://mongo.fillcreative.io/api/boards/add-ad" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "board_id": "strategy_board",
    "ad_id": "1167590351480379"
  }'
# Response: {"success": true, "data": {"ad_id": "1167590351480379"}}

7.2 Add Ads to Q1 Campaign Board

curl -X POST "https://mongo.fillcreative.io/api/boards/add-ad" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "board_id": "q1_board",
    "ad_id": "1701420067074004"
  }'
# Response: {"success": true, "data": {"ad_id": "1701420067074004"}}

7.3 Add Multiple Ads to Electronics Board

# Add first ad
curl -X POST "https://mongo.fillcreative.io/api/boards/add-ad" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "board_id": "electronics_board",
    "ad_id": "9057993370952884"
  }'
# Response: {"success": true, "data": {"ad_id": "9057993370952884"}}

# Add second ad
curl -X POST "https://mongo.fillcreative.io/api/boards/add-ad" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "board_id": "electronics_board",
    "ad_id": "1153676022949909"
  }'
# Response: {"success": true, "data": {"ad_id": "1153676022949909"}}

8. Search Examples

8.1 Search for "Electronics"

curl -X POST "https://mongo.fillcreative.io/api/search" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "query": "electronics"
  }'

Response:

{
    "success": true,
    "data": {
        "folders": [
            {
                "_id": "electronics_folder",
                "name": "Electronics",
                "parent_path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder",
                "ads_ids": []
            }
        ],
        "boards": [
            {
                "_id": "electronics_board",
                "name": "Electronics Promotion",
                "description": "Special deals and promotions for electronics",
                "folder_path": "folders/mc_root/subfolders/q1_folder/subfolders/products_folder/subfolders/electronics_folder",
                "ads_ids": ["9057993370952884", "1153676022949909"]
            }
        ]
    }
}

8.2 Search for "Campaign"

curl -X POST "https://mongo.fillcreative.io/api/search" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "query": "campaign"
  }'

Response:

{
    "success": true,
    "data": {
        "folders": [
            {
                "_id": "mc_root",
                "name": "Marketing Campaigns 2024",
                "parent_path": null,
                "ads_ids": []
            },
            {
                "_id": "q1_folder",
                "name": "Q1 Campaigns",
                "parent_path": "folders/mc_root",
                "ads_ids": []
            }
        ],
        "boards": [
            {
                "_id": "q1_board",
                "name": "Q1 Launch Campaign",
                "description": "New product launch campaign for Q1",
                "folder_path": "folders/mc_root/subfolders/q1_folder",
                "ads_ids": ["1701420067074004"]
            }
        ]
    }
}

Final Structure

Marketing Campaigns 2024/
├── Overall Strategy 2024 [Board]
│   └── Ads: [1167590351480379]
│
├── Q1 Campaigns/
│   ├── Q1 Launch Campaign [Board]
│   │   └── Ads: [1701420067074004]
│   │
│   └── Product Lines/
│       └── Electronics/
│           ├── Electronics Promotion [Board]
│           │   └── Ads: [9057993370952884, 1153676022949909]
│           │
│           └── Smartphones/

9. Search Ads by IDs

Retrieve ad details for multiple ad IDs.

curl --location 'https://ads.fillcreative.io/ads/search' \
--header 'Content-Type: application/json' \
--data '{
    "ids": [
        "1167590351480379",
        "1701420067074004",
        "9057993370952884",
        "1153676022949909",
        "2169073583555253",
        "602474086036798",
        "1107419951161461",
        "921883373451475"
    ]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment