# 1C HTTP services: create, publish, test and debug with examples

Source: https://checkcraft.ru/en/guides/1c-http-service.html · updated 2026-11-24

How to create an HTTP service in 1C 8.3, define URL templates and methods, return JSON with the right Content-Type, publish it on a web server…

Practical workflow

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. [Download, no sign-up →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

An HTTP service turns a 1C database into a REST API for a website, a mobile app or another system. Below is the whole path: the configuration object, URL template and handler, a JSON response, publishing, the /hs/ address, testing from outside and the usual integration errors.

Checkcraft · 24 November 2026

Get help with your first test →

## How an HTTP service is built

In the configuration under Common you add an HTTP service with a root URL such as api. Inside are URL templates like /orders/{id}, each template has GET, POST and other methods, and each method has a handler in the service module. The handler gets an HTTPServiceRequest and returns an HTTPServiceResponse.

## Where to find the service after publishing

After publishing the database on a web server the service is available at http://server/publication_name/hs/root_url/template. If the address returns 404, check that HTTP services are published by default or the service is ticked in the list.

Repeating checks like this by hand? Checkcraft saves them and reruns them in one click. [Download Free →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

## How to test the service from outside

Send a request with curl or an API client using a 1C account and look at the status, headers and body. Check not just the happy path: a missing id, broken JSON in the body, a request without auth. Each should return a clear code and a JSON error, not a web server page.

## How to save the checks and repeat them

The service changes with the configuration, and what worked yesterday may answer differently after an update. Save requests to the service with response rules and run them after every update. That is integration regression testing.

## A handler that returns JSON

```
// Шаблон URL: /orders/{id}, метод GET, обработчик ЗаказGET
Функция ЗаказGET(Запрос)
    Ид = Запрос.ПараметрыURL["id"];
    Заказ = НайтиЗаказ(Ид); // ваша функция

    Если Заказ = Неопределено Тогда
        Возврат ОтветJSON(404, Новый Структура("error", "order not found"));
    КонецЕсли;
    Возврат ОтветJSON(200, Заказ);
КонецФункции

Функция ОтветJSON(Код, Значение)
    Запись = Новый ЗаписьJSON;
    Запись.УстановитьСтроку();
    ЗаписатьJSON(Запись, Значение);
    Ответ = Новый HTTPСервисОтвет(Код);
    Ответ.Заголовки.Вставить("Content-Type", "application/json; charset=utf-8");
    Ответ.УстановитьТелоИзСтроки(Запись.Закрыть(), "UTF-8", ИспользованиеByteOrderMark.НеИспользовать);
    Возврат Ответ;
КонецФункции
```

Content-Type with charset and a body without a BOM spare the client half of the parsing problems. Return errors as JSON with the right code too, not as text.

## Testing the service with curl

```
# GET существующего и несуществующего заказа
curl -i -u "Обмен:пароль" http://erp.example.local/trade/hs/api/orders/5001
curl -i -u "Обмен:пароль" http://erp.example.local/trade/hs/api/orders/999999

# POST с JSON
curl -i -u "Обмен:пароль" -H "Content-Type: application/json" \
  --data '{"sku":"A-1","qty":2}' http://erp.example.local/trade/hs/api/orders

# без авторизации: ожидаем 401, а не страницу веб-сервера
curl -i http://erp.example.local/trade/hs/api/orders/5001
```

The address is the web server publication name, the /hs/ segment, the service root URL and the template. More request examples in [curl POST with JSON](https://checkcraft.ru/en/guides/curl-post-json.html).

## What to check in an HTTP service

| Check | Expected |
|---|---|
| Existing object | 200 and JSON with the right fields |
| Missing id | 404 and a JSON error |
| Broken JSON in a POST body | 400 and an error description |
| No auth | 401, not a web server page |
| User without rights | 403 |
| Cyrillic in data | Not garbled, UTF-8 |

## Common problems

- 404 on the right address. The service is not published or published under another publication.
- The response is an HTML page. The error happened before the handler: auth, publishing, licence.
- Cyrillic is garbled. The body is not UTF-8 or charset is missing.
- The client cannot parse JSON. A BOM at the start of the body, see [unexpected character when reading JSON](https://checkcraft.ru/en/guides/1c-json-unexpected-character.html).

## More on 1C

Section overview and all guides: [1C integration via API: options, architecture and examples](https://checkcraft.ru/en/guides/1c-api-integration.html).

- [HTTP requests from 1C: GET, POST, headers, auth and timeouts with examples](https://checkcraft.ru/en/guides/1c-http-request.html)
- [HTTP request failed in 1C: causes and fixes](https://checkcraft.ru/en/guides/1c-http-request-error.html)
- [OData in 1C: setup, queries and REST integration with examples](https://checkcraft.ru/en/guides/1c-odata.html)
- [1C web services (SOAP): create, publish, WSDL and calls with examples](https://checkcraft.ru/en/guides/1c-web-service.html)
- [Publishing 1C on IIS and Apache: step by step and common errors](https://checkcraft.ru/en/guides/1c-web-publish.html)

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 Free](https://checkcraft.ru/en/download-checkcraft.html#free-download) · [Download and first run](https://checkcraft.ru/en/download-checkcraft.html)

No sign-up or email needed, the archive is ready in a couple of minutes. See the [edition limits](https://checkcraft.ru/en/pricing.html).

## References

[RFC 9110: HTTP semantics](https://www.rfc-editor.org/rfc/rfc9110)

## Continue with a related task

[HTTP requests from 1C: GET, POST, headers, auth and timeouts with examples](https://checkcraft.ru/en/guides/1c-http-request.html) · [HTTP request failed in 1C: causes and fixes](https://checkcraft.ru/en/guides/1c-http-request-error.html) · [JSON in 1C:Enterprise: read, write, HTTP requests and common errors](https://checkcraft.ru/en/guides/1c-json.html) · [API regression testing and response comparison](https://checkcraft.ru/en/guides/api-regression-testing.html) · [Integration testing across API, logs and database](https://checkcraft.ru/en/guides/integration-testing-workflow.html)

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.

[Ask in Telegram](https://t.me/checkcraftchat)Send an email

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

Page card: /ai/pages/en/guides/1c-http-service.md
