# m.justmc.ru/api/upload

### Как работает

Загружает код на сервер и возвращает идентификатор загруженного объекта.

**Тело запроса (JSON)**

В запрос передаётся JSON с содержимым кода.

```json
{
  "blocks": [
    {
      "type": "message",
      "text": "Hello world"
    }
  ]
}
```

**Пример запроса на python**

```python
import requests

code = {
    "blocks": [
        {
            "type": "message",
            "text": "Hello world"
        }
    ]
}

response = requests.post(
    "https://m.justmc.ru/api/upload",
    json=code
)

data = response.json()
print(data)
```

При успешной работы программы вернет Json с ID загруженного кода

После загрузки можно получить ID:

```python
response = requests.post(
    "https://m.justmc.ru/api/upload",
    json=code
).json()

upload_id = response["id"]
print(upload_id)
```

### **Где используется**

Используется в [JMCC](https://github.com/donzgold/JustMC_compilator/) для загрузки кода на облако, а затем уже на сам сервер.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://justapi.dominosmersi.ru/user-api/m.justmc.ru-api-upload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
