Detect MIME Type
Detects the MIME type of a file or data payload using the ZXing library. Accepts either a file upload or raw data (text or hex-encoded).
Request
POST /nxt?requestType=detectMimeType&data=<data>&filename=<name>&isText=<boolean>
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
file | multipart | Conditional | File upload. Either file or data must be provided. |
data | string | Conditional | Raw data payload. Either file or data must be provided. |
filename | string | No | Filename hint for MIME detection. |
isText | boolean | No | If true (default), data is treated as UTF-8 text. If false, data is treated as hex-encoded bytes. |
Response
{
"type": "image/jpeg"
}
Response Fields
| Field | Type | Description |
|---|---|---|
type | string | Detected MIME type (e.g., image/jpeg, text/plain, application/octet-stream). |
Error Responses
| Condition | Response |
|---|---|
| Missing file or data | JSONResponses.INCORRECT_FILE |
Notes
- This endpoint does not require the blockchain to be running (
requireBlockchain = false). - Not chain-specific.
- Does not require admin password authentication (
requirePassword = false). - Uses
Search.detectMimeType()for detection.
Source: DetectMimeType.java.
Example
curl -X POST "http://localhost:22024/nxt" \
-d "requestType=detectMimeType" \
-d "data=Hello World"