Skip to content
CheckcraftDownload
Practical workflow

OData in 1C: setup, queries and REST integration with examples

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. Download, no sign-up →

The standard OData interface is built-in REST access to 1C data without writing HTTP services. It is enabled when publishing the database, after which catalogs and documents are available at addresses like /odata/standard.odata/Catalog_Name. Below are setup, queries, testing and errors.

Checkcraft ·

Get help with your first test →

What the standard OData interface is

It is a REST protocol the platform supports itself: an external service reads and, if allowed, changes catalogs, documents and registers with ordinary HTTP requests. No handlers to write, but the set of available objects and the rights are configured explicitly.

How to enable OData

When publishing the database on a web server, tick the standard OData interface. Then choose which objects the interface exposes: standard configurations on the SSL library have a setup data processor, others call SetStandardODataInterfaceContent. Give the exchange user a role with rights only to the needed objects.

API call diagram: method and URL, headers, body, status and response body, logs and database

How to test the interface from outside

Open /odata/standard.odata/ with a 1C account: it returns the list of available entities. An empty list means the object set was not configured. Then request one entity with $format=json and $top so you do not pull the whole catalog.

When OData and when an HTTP service

OData suits an external system that needs to read data as is when you do not want to write code. An HTTP service is better when you need your own logic, input validation, a custom response format or protection from extra fields. Many integrations use both.

Layers of an API call check: status, headers, body, calculations, logs, database

OData queries with curl

# список доступных сущностей
curl -u "Обмен:пароль" "http://erp.example.local/trade/odata/standard.odata/?\$format=json"

# первые 10 позиций номенклатуры, только ключ и наименование
curl -u "Обмен:пароль" "http://erp.example.local/trade/odata/standard.odata/Catalog_Номенклатура?\$format=json&\$top=10&\$select=Ref_Key,Description"

# отбор по наименованию
curl -u "Обмен:пароль" -G "http://erp.example.local/trade/odata/standard.odata/Catalog_Номенклатура" \
  --data-urlencode "\$format=json" --data-urlencode "\$filter=Description eq 'Монитор 24'"

The dollar sign is escaped on a Linux shell. In Windows PowerShell put the URL in single quotes or use curl.exe. Cyrillic entity names are passed as is; curl encodes them.

What the response looks like

{
  "odata.metadata": "http://erp.example.local/trade/odata/standard.odata/$metadata#Catalog_Номенклатура",
  "value": [
    { "Ref_Key": "6a1c...e3", "Description": "Монитор 24" },
    { "Ref_Key": "9b7f...10", "Description": "Клавиатура" }
  ]
}

The record key comes in Ref_Key and the name in Description. References to other objects come as keys ending in _Key, not as names.

OData query parameters

ParameterWhat it doesExample
$format=jsonJSON instead of XML?$format=json
$topLimit the number of records$top=10
$skipSkip records for paging$skip=100
$selectOnly the needed fields$select=Ref_Key,Description
$filterFilter by a condition$filter=Description eq 'Monitor 24'
$orderbySorting$orderby=Description

Common OData errors

ResponseCauseFix
401No auth or wrong passwordSend the 1C user login and password
403The user lacks rights to the objectGrant a role with rights to the objects
404 on an entityThe object is not in the OData interface setAdd it to the set and retry
Empty entity listThe interface set is not configuredConfigure it with the data processor or code
HTML instead of JSONPublishing error or no $format=jsonCheck the publication URL and the format parameter

Saved OData requests with field checks are a simple way to notice that after a configuration update the integration started getting different data. See API regression testing.

More on 1C

Section overview and all guides: 1C integration via API: options, architecture and examples.

Frequently asked questions

How do I enable OData in 1C?

Tick the standard OData interface when publishing and configure which objects it exposes; give the exchange user rights to them.

What is the OData address?

http://server/publication/odata/standard.odata/, entities like Catalog_Name and Document_Name.

How do I get JSON from 1C OData?

Add $format=json; without it the response is XML.

Why does a catalog return 404?

It is not in the standard OData interface set.

Next step

Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

Download FreeDownload and first run

No sign-up or email needed, the archive is ready in a couple of minutes. See the edition limits.

References

OData protocol documentation

Start with the linked example and compare its result with your own test requirement.

Ask a person

Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

No account required. We will reply by email. This is a support request, not a newsletter subscription.