# marketo/rest-sample-code architecture

> Architecture diagram of the GitHub repository marketo/rest-sample-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marketo/rest-sample-code
- Repository: https://github.com/marketo/rest-sample-code

## Overview

This repository is a multilingual collection of Marketo REST API examples, not a single application. A user selects a sample, supplies instance credentials and request data, and invokes an endpoint; the result is typically printed or returned. The catalog covers asset management, lead and campaign operations, and authentication, with a Python example that exports all leads to CSV. README statements establish the sample-to-endpoint pattern; the sampled files show representative OAuth requests and export steps, not shared runtime wiring.

Main entry points: [`python/LeadDatabase/Leads/get_every_lead.py`](https://github.com/marketo/rest-sample-code/blob/master/python/LeadDatabase/Leads/get_every_lead.py) (All-lead exporter), [`c#/Authentication/Identity/Identity.cs`](https://github.com/marketo/rest-sample-code/blob/master/c%23/Authentication/Identity/Identity.cs) (Identity token sample), [`java/Asset/EmailTemplates/CreateEmailTemplate.java`](https://github.com/marketo/rest-sample-code/blob/master/java/Asset/EmailTemplates/CreateEmailTemplate.java) (Email assets), [`c#/Asset/Programs/UpdateProgramMetadata.cs`](https://github.com/marketo/rest-sample-code/blob/master/c%23/Asset/Programs/UpdateProgramMetadata.cs) (Programs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Authentication"]
  node_identity["Identity token sample<br/>[Identity.cs]"]
end

subgraph group_assets["Asset APIs"]
  node_asset_email["Email assets"]
  node_asset_content["Content assets"]
  node_asset_program["Programs"]
  node_asset_files["Files and folders<br/>[CreateFile.cs]"]
  node_asset_snippets["Snippets and tokens"]
  node_asset_taxonomy["Channels and tags"]
end

subgraph group_lead["Lead Database APIs"]
  node_lead_records["Leads and companies<br/>[SyncLeads.cs]"]
  node_lead_activities["Activities"]
  node_lead_campaigns["Campaigns<br/>[GetCampaigns.java]"]
  node_lead_objects["Custom objects"]
  node_lead_opportunities["Opportunities and sales"]
  node_lead_lists["Static lists<br/>[GetLists.cs]"]
  node_lead_usage["Usage reporting"]
  node_bulk_leads["Bulk lead operations<br/>[ImportLeads.java]"]
end

subgraph group_extract["Lead Export"]
  node_exporter["All-lead exporter<br/>[get_every_lead.py]"]
  node_csv["CSV output"]
end

node_user(("Sample user"))
node_marketo{{"Marketo REST API"}}

node_user -->|"runs sample"| node_identity
node_identity -->|"requests token"| node_marketo
node_user -->|"runs sample"| node_asset_email
node_user -->|"runs sample"| node_asset_content
node_user -->|"runs sample"| node_asset_program
node_user -->|"runs sample"| node_asset_files
node_user -->|"runs sample"| node_asset_snippets
node_user -->|"runs sample"| node_asset_taxonomy
node_user -->|"runs sample"| node_lead_records
node_user -->|"runs sample"| node_lead_activities
node_user -->|"runs sample"| node_lead_campaigns
node_user -->|"runs sample"| node_lead_objects
node_user -->|"runs sample"| node_lead_opportunities
node_user -->|"runs sample"| node_lead_lists
node_user -->|"runs sample"| node_lead_usage
node_user -->|"runs sample"| node_bulk_leads
node_user -->|"runs sample"| node_exporter
node_asset_email -->|"creates template"| node_marketo
node_asset_program -->|"updates program"| node_marketo
node_lead_lists -->|"requests lists"| node_marketo
node_lead_campaigns -->|"requests campaigns"| node_marketo
node_exporter -->|"requests lead data"| node_marketo
node_exporter -->|"writes rows"| node_csv

click node_identity "https://github.com/marketo/rest-sample-code/blob/master/c%23/Authentication/Identity/Identity.cs"
click node_asset_email "https://github.com/marketo/rest-sample-code/blob/master/java/Asset/EmailTemplates/CreateEmailTemplate.java"
click node_asset_content "https://github.com/marketo/rest-sample-code/tree/master/java/Asset/LandingPageTemplates"
click node_asset_program "https://github.com/marketo/rest-sample-code/blob/master/c%23/Asset/Programs/UpdateProgramMetadata.cs"
click node_asset_files "https://github.com/marketo/rest-sample-code/blob/master/c%23/Asset/Files/CreateFile.cs"
click node_asset_snippets "https://github.com/marketo/rest-sample-code/tree/master/c%23/Asset/Snippets"
click node_asset_taxonomy "https://github.com/marketo/rest-sample-code/tree/master/c%23/Asset/Channels"
click node_lead_records "https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/Leads/SyncLeads.cs"
click node_lead_activities "https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/Activities/GetLeadActivities.cs"
click node_lead_campaigns "https://github.com/marketo/rest-sample-code/blob/master/java/LeadDatabase/Campaigns/GetCampaigns.java"
click node_lead_objects "https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/CustomObjects/GetCustomObjects.cs"
click node_lead_opportunities "https://github.com/marketo/rest-sample-code/tree/master/c%23/LeadDatabase/Opportunities"
click node_lead_lists "https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/StaticLists/GetLists.cs"
click node_lead_usage "https://github.com/marketo/rest-sample-code/tree/master/c%23/LeadDatabase/Usage"
click node_bulk_leads "https://github.com/marketo/rest-sample-code/blob/master/java/LeadDatabase/BulkLeads/ImportLeads.java"
click node_exporter "https://github.com/marketo/rest-sample-code/blob/master/python/LeadDatabase/Leads/get_every_lead.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_identity,node_user toneBlue
class node_asset_email,node_asset_content,node_asset_program,node_asset_files,node_asset_snippets,node_asset_taxonomy toneAmber
class node_lead_records,node_lead_activities,node_lead_campaigns,node_lead_objects,node_lead_opportunities,node_lead_lists,node_lead_usage,node_bulk_leads,node_marketo toneMint
class node_exporter,node_csv toneRose
```

## Components

### Authentication

- [Identity token sample](https://github.com/marketo/rest-sample-code/blob/master/c%23/Authentication/Identity/Identity.cs): `c#/Authentication/Identity/Identity.cs`

### Asset APIs

- [Email assets](https://github.com/marketo/rest-sample-code/blob/master/java/Asset/EmailTemplates/CreateEmailTemplate.java): `java/Asset/EmailTemplates/CreateEmailTemplate.java`
- [Content assets](https://github.com/marketo/rest-sample-code/tree/master/java/Asset/LandingPageTemplates): `java/Asset/LandingPageTemplates`
- [Programs](https://github.com/marketo/rest-sample-code/blob/master/c%23/Asset/Programs/UpdateProgramMetadata.cs): `c#/Asset/Programs/UpdateProgramMetadata.cs`
- [Files and folders](https://github.com/marketo/rest-sample-code/blob/master/c%23/Asset/Files/CreateFile.cs): `c#/Asset/Files/CreateFile.cs`
- [Snippets and tokens](https://github.com/marketo/rest-sample-code/tree/master/c%23/Asset/Snippets): `c#/Asset/Snippets`
- [Channels and tags](https://github.com/marketo/rest-sample-code/tree/master/c%23/Asset/Channels): `c#/Asset/Channels`

### Lead Database APIs

- [Leads and companies](https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/Leads/SyncLeads.cs): `c#/LeadDatabase/Leads/SyncLeads.cs`
- [Activities](https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/Activities/GetLeadActivities.cs): `c#/LeadDatabase/Activities/GetLeadActivities.cs`
- [Campaigns](https://github.com/marketo/rest-sample-code/blob/master/java/LeadDatabase/Campaigns/GetCampaigns.java): `java/LeadDatabase/Campaigns/GetCampaigns.java`
- [Custom objects](https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/CustomObjects/GetCustomObjects.cs): `c#/LeadDatabase/CustomObjects/GetCustomObjects.cs`
- [Opportunities and sales](https://github.com/marketo/rest-sample-code/tree/master/c%23/LeadDatabase/Opportunities): `c#/LeadDatabase/Opportunities`
- [Static lists](https://github.com/marketo/rest-sample-code/blob/master/c%23/LeadDatabase/StaticLists/GetLists.cs): `c#/LeadDatabase/StaticLists/GetLists.cs`
- [Usage reporting](https://github.com/marketo/rest-sample-code/tree/master/c%23/LeadDatabase/Usage): `c#/LeadDatabase/Usage`
- [Bulk lead operations](https://github.com/marketo/rest-sample-code/blob/master/java/LeadDatabase/BulkLeads/ImportLeads.java): `java/LeadDatabase/BulkLeads/ImportLeads.java`

### Lead Export

- [All-lead exporter](https://github.com/marketo/rest-sample-code/blob/master/python/LeadDatabase/Leads/get_every_lead.py): `python/LeadDatabase/Leads/get_every_lead.py`
- **CSV output**

### Other components

- **Sample user**
- **Marketo REST API**

## Connections

- Sample user → Identity token sample: runs sample
- Identity token sample → Marketo REST API: requests token (evidence: `c#/Authentication/Identity/Identity.cs`)
- Sample user → Email assets: runs sample
- Sample user → Content assets: runs sample
- Sample user → Programs: runs sample
- Sample user → Files and folders: runs sample
- Sample user → Snippets and tokens: runs sample
- Sample user → Channels and tags: runs sample
- Sample user → Leads and companies: runs sample
- Sample user → Activities: runs sample
- Sample user → Campaigns: runs sample
- Sample user → Custom objects: runs sample
- Sample user → Opportunities and sales: runs sample
- Sample user → Static lists: runs sample
- Sample user → Usage reporting: runs sample
- Sample user → Bulk lead operations: runs sample
- Sample user → All-lead exporter: runs sample
- Email assets → Marketo REST API: creates template (evidence: `java/Asset/EmailTemplates/CreateEmailTemplate.java`)
- Programs → Marketo REST API: updates program (evidence: `c#/Asset/Programs/UpdateProgramMetadata.cs`)
- Static lists → Marketo REST API: requests lists (evidence: `c#/LeadDatabase/StaticLists/GetLists.cs`)
- Campaigns → Marketo REST API: requests campaigns (evidence: `java/LeadDatabase/Campaigns/GetCampaigns.java`)
- All-lead exporter → Marketo REST API: requests lead data (evidence: `python/LeadDatabase/Leads/get_every_lead.py`)
- All-lead exporter → CSV output: writes rows (evidence: `python/LeadDatabase/Leads/get_every_lead.py`)
