# OData Service Extractor (`datamule/odata-service-extractor`) Actor

Point at ANY OData service (v2/v3/v4) — SAP, Dynamics 365, Business Central, Dataverse, SharePoint, national-stats & gov portals. Pick an entity set or auto-discover from $metadata; apply $filter/$select/$orderby/$expand; auto-paginate to flat rows + raw. Pay per row.

- **URL**: https://apify.com/datamule/odata-service-extractor.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 entities

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## OData Service Extractor

A **generic "point at any OData service" scraper**. [OData](https://www.odata.org) (the OASIS
query protocol) is the query language behind **SAP, Microsoft Dynamics 365 / Business Central,
Dataverse / Power Platform, SharePoint lists**, and a huge number of **national-statistics and
open-government portals** — yet there was no generic runner on the Store. Give this actor a
service root URL, optionally pick an entity set (or let it auto-discover them from `$metadata`),
apply the standard OData query options, and it pages the whole result set into clean, flat
dataset rows plus a lossless `raw` object.

Works with **all three OData JSON envelopes** — v4 (`@odata.*`), v3 (`odata.*`) and legacy v2
verbose (`d.results`) — detected automatically from the response.

### What it does

- **Extract an entity set** — set the service root + entity set (e.g. `Products`, `Customers`,
  `TypedDataSet`) and it pulls every matching row, auto-following `@odata.nextLink` /
  `odata.nextLink` / `__next` pagination up to your **Max results**.
- **Auto-discover** — leave the entity set empty and it reads `$metadata`, then extracts across
  all discovered sets (sharing the Max-results budget). Or turn on **List entity sets only** to
  just return the catalogue (name + entity type + items URL) without pulling data.
- **Query options** — `$filter`, `$select`, `$orderby`, `$expand`, `$search`, `$top` map to the
  matching fields. Anything else can go in **Extra query parameters**.
- **Flat + raw** — each entity's scalar properties are spread to columns (OData annotations and
  v2 deferred navigation links stripped); the untouched entity is kept in `raw`, so nothing is
  lost even though every service has a different shape.

### Example inputs

Northwind products (OData v4 demo):

```json
{ "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc", "entitySet": "Products", "orderby": "UnitPrice desc", "maxResults": 100 }
````

Statistics Netherlands, a real government v3 service (no auth):

```json
{ "serviceRoot": "https://opendata.cbs.nl/ODataApi/odata/83765NED", "entitySet": "TypedDataSet", "top": 100, "maxResults": 500 }
```

Filter + select:

```json
{ "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc", "entitySet": "Products", "filter": "UnitPrice gt 20 and Discontinued eq false", "select": "ProductID,ProductName,UnitPrice" }
```

Discover what a service exposes:

```json
{ "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc", "listEntitySetsOnly": true }
```

### Authentication

**None required** for public services. For tenant-gated endpoints (Dynamics 365 / Business
Central / Dataverse / SharePoint) supply a **Bearer token** and/or **Extra request headers** —
both optional, never required, and the token is never logged.

### Output

One dataset item per entity, with fixed meta columns:

- `_entitySet` — the set the row came from.
- `_odataVersion` — detected envelope version (`v2` / `v3` / `v4`).
- `_id` — the entity's OData id / edit URL / v2 `__metadata.uri` (when present).
- …plus every business property of the entity as its own column, and `raw` = the complete
  original object.

A query that matches nothing returns **0 items, not an error**.

### Pricing

**Pay per row** — you're charged one `entity` event per record returned (one per entity set in
list-only mode). A query that matches nothing costs nothing.

### Notes

- Handles OData v2, v3 and v4; relative and absolute `nextLink`s; single-entity-by-key requests.
- Not affiliated with or endorsed by OASIS, OData, Microsoft, SAP, or any target service.

# Actor input Schema

## `serviceRoot` (type: `string`):

The root URL of ANY OData service (v2, v3 or v4). Examples: https://services.odata.org/V4/Northwind/Northwind.svc , https://opendata.cbs.nl/ODataApi/odata/83765NED (Statistics Netherlands), or your SAP / Dynamics 365 / Business Central / Dataverse / SharePoint OData endpoint. Do NOT include the entity set here — put that in the field below (or leave it empty to auto-discover).

## `entitySet` (type: `string`):

The entity set (collection) to extract, e.g. Products, Customers, Orders, or TypedDataSet on CBS. Leave EMPTY to auto-discover the service's entity sets from its $metadata and extract across all of them (sharing the Max results budget). Tip: turn on "List entity sets only" below to just see what's available first.

## `listEntitySetsOnly` (type: `boolean`):

When on, the actor only reads the service's $metadata and returns one row per available entity set (name + entity type + items URL) — it does NOT pull any data. Use this to discover what a service exposes, then set the Entity set above to extract one.

## `filter` (type: `string`):

OData $filter expression (server-side row filter), e.g. UnitPrice gt 20 , Discontinued eq false , contains(ProductName,'Chai') , or Year eq 2023. Uses the target service's OData grammar. Leave empty for no filter.

## `select` (type: `string`):

Comma-separated list of properties to return, e.g. ProductID,ProductName,UnitPrice. Narrows each row to just these fields (the full object is still kept in raw). Leave empty for all properties.

## `orderby` (type: `string`):

OData $orderby, e.g. UnitPrice desc or ProductName asc. Leave empty for the service's default order.

## `expand` (type: `string`):

OData $expand — inline related entities, e.g. Category or Orders($top=5). Expanded objects are kept in each row and in raw. Leave empty for none.

## `search` (type: `string`):

Free-text $search term (only supported on OData v4 services that enable it, e.g. many Dynamics/SharePoint endpoints). Ignored by services that don't support it. Leave empty for none.

## `top` (type: `integer`):

OData $top — asks the service for at most this many rows in the FIRST request. Most services also apply their own server-side paging; the actor follows nextLink regardless. Leave empty to use the service default. Use "Max results" below to cap the TOTAL number of rows pulled across all pages.

## `maxResults` (type: `integer`):

Maximum total number of rows to pull across all pages (the actor auto-follows @odata.nextLink / odata.nextLink / \_\_next). Each returned row is one billable entity. Default 1000.

## `queryParams` (type: `object`):

Optional extra URL query parameters to add to every request, as a JSON object, e.g. {"api-version": "9.2"} for Dynamics or a service-specific param. OData $-options are better set in the fields above.

## `bearerToken` (type: `string`):

Optional OAuth2 bearer token for tenant-gated services (Dynamics 365 / Business Central / Dataverse / SharePoint). Sent as the Authorization: Bearer header. NOT required for public services — leave empty. Never logged.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers to send with every request, as a JSON object, e.g. {"OData-Version": "4.0", "Prefer": "odata.maxpagesize=200"}. Use for services that need a custom header. Leave empty for public services.

## Actor input object example

```json
{
  "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc",
  "entitySet": "Products",
  "listEntitySetsOnly": false,
  "maxResults": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc",
    "entitySet": "Products",
    "maxResults": 1000
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/odata-service-extractor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc",
    "entitySet": "Products",
    "maxResults": 1000,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/odata-service-extractor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "serviceRoot": "https://services.odata.org/V4/Northwind/Northwind.svc",
  "entitySet": "Products",
  "maxResults": 1000
}' |
apify call datamule/odata-service-extractor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/odata-service-extractor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "OData Service Extractor",
        "description": "Point at ANY OData service (v2/v3/v4) — SAP, Dynamics 365, Business Central, Dataverse, SharePoint, national-stats & gov portals. Pick an entity set or auto-discover from $metadata; apply $filter/$select/$orderby/$expand; auto-paginate to flat rows + raw. Pay per row.",
        "version": "0.1",
        "x-build-id": "XAFTcDhApy0fc4Hmr"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamule~odata-service-extractor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamule-odata-service-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamule~odata-service-extractor/runs": {
            "post": {
                "operationId": "runs-sync-datamule-odata-service-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamule~odata-service-extractor/run-sync": {
            "post": {
                "operationId": "run-sync-datamule-odata-service-extractor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "serviceRoot"
                ],
                "properties": {
                    "serviceRoot": {
                        "title": "OData service root URL",
                        "type": "string",
                        "description": "The root URL of ANY OData service (v2, v3 or v4). Examples: https://services.odata.org/V4/Northwind/Northwind.svc , https://opendata.cbs.nl/ODataApi/odata/83765NED (Statistics Netherlands), or your SAP / Dynamics 365 / Business Central / Dataverse / SharePoint OData endpoint. Do NOT include the entity set here — put that in the field below (or leave it empty to auto-discover)."
                    },
                    "entitySet": {
                        "title": "Entity set",
                        "type": "string",
                        "description": "The entity set (collection) to extract, e.g. Products, Customers, Orders, or TypedDataSet on CBS. Leave EMPTY to auto-discover the service's entity sets from its $metadata and extract across all of them (sharing the Max results budget). Tip: turn on \"List entity sets only\" below to just see what's available first."
                    },
                    "listEntitySetsOnly": {
                        "title": "List entity sets only (discovery)",
                        "type": "boolean",
                        "description": "When on, the actor only reads the service's $metadata and returns one row per available entity set (name + entity type + items URL) — it does NOT pull any data. Use this to discover what a service exposes, then set the Entity set above to extract one.",
                        "default": false
                    },
                    "filter": {
                        "title": "$filter",
                        "type": "string",
                        "description": "OData $filter expression (server-side row filter), e.g. UnitPrice gt 20 , Discontinued eq false , contains(ProductName,'Chai') , or Year eq 2023. Uses the target service's OData grammar. Leave empty for no filter."
                    },
                    "select": {
                        "title": "$select",
                        "type": "string",
                        "description": "Comma-separated list of properties to return, e.g. ProductID,ProductName,UnitPrice. Narrows each row to just these fields (the full object is still kept in raw). Leave empty for all properties."
                    },
                    "orderby": {
                        "title": "$orderby",
                        "type": "string",
                        "description": "OData $orderby, e.g. UnitPrice desc or ProductName asc. Leave empty for the service's default order."
                    },
                    "expand": {
                        "title": "$expand",
                        "type": "string",
                        "description": "OData $expand — inline related entities, e.g. Category or Orders($top=5). Expanded objects are kept in each row and in raw. Leave empty for none."
                    },
                    "search": {
                        "title": "$search",
                        "type": "string",
                        "description": "Free-text $search term (only supported on OData v4 services that enable it, e.g. many Dynamics/SharePoint endpoints). Ignored by services that don't support it. Leave empty for none."
                    },
                    "top": {
                        "title": "$top (server-side page size)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "OData $top — asks the service for at most this many rows in the FIRST request. Most services also apply their own server-side paging; the actor follows nextLink regardless. Leave empty to use the service default. Use \"Max results\" below to cap the TOTAL number of rows pulled across all pages."
                    },
                    "maxResults": {
                        "title": "Max results (total)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum total number of rows to pull across all pages (the actor auto-follows @odata.nextLink / odata.nextLink / __next). Each returned row is one billable entity. Default 1000.",
                        "default": 1000
                    },
                    "queryParams": {
                        "title": "Extra query parameters",
                        "type": "object",
                        "description": "Optional extra URL query parameters to add to every request, as a JSON object, e.g. {\"api-version\": \"9.2\"} for Dynamics or a service-specific param. OData $-options are better set in the fields above."
                    },
                    "bearerToken": {
                        "title": "Bearer token (optional)",
                        "type": "string",
                        "description": "Optional OAuth2 bearer token for tenant-gated services (Dynamics 365 / Business Central / Dataverse / SharePoint). Sent as the Authorization: Bearer header. NOT required for public services — leave empty. Never logged."
                    },
                    "extraHeaders": {
                        "title": "Extra request headers",
                        "type": "object",
                        "description": "Optional extra HTTP headers to send with every request, as a JSON object, e.g. {\"OData-Version\": \"4.0\", \"Prefer\": \"odata.maxpagesize=200\"}. Use for services that need a custom header. Leave empty for public services."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
