Get model code
Generate executable code for a trained model. Only `java` and `sql` are supported (`CoreConstants.MODEL_LANGUAGE_JAVA`/`_SQL`); any other value throws and surfaces as a `500`. Not every model type supports both languages. `language` is **required** — there is no default; an omitted or empty value is a `400`. The response body is the standard `JSONResponse` envelope (`values.string`) — but the `Content-Type` response header is `text/plain` on every status code (200/400/500), not `application/json`. The body content itself is still JSON text; only the header is misleading.
Generate executable code for a trained model. Only java and sql
are supported (CoreConstants.MODEL_LANGUAGE_JAVA/_SQL); any other
value throws and surfaces as a 500. Not every model type supports
both languages. language is required — there is no default; an
omitted or empty value is a 400. The response body is the standard
JSONResponse envelope (values.string) — but the Content-Type
response header is text/plain on every status code (200/400/500),
not application/json. The body content itself is still JSON text;
only the header is misleading.
Authorization
SymetryMLAuth HMAC-SHA256 signature-based authentication: requests are signed with
your secret key and sent with the Customer-ID, Sym-date,
Authorization, Content-MD5 and sym-version headers.
See SymetryML REST API Security
for the signature algorithm and a complete example.
In: header
Path Parameters
User/Customer identifier
Project identifier
Model identifier
Query Parameters
Target language for code generation. Required. (sql is also valid but not reflected in the rendered "Try it" example below, which always shows the Java response code.)
Value in
- "java"
- "sql"
Response Body
text/plain
text/plain
text/plain
curl -X GET "https://example.com/c1/projects/nbra_prj_iris/models/nbra_prj_iris_build_1/code?language=java"{ "statusCode": 200, "statusString": "OK", "values": { "string": "/* Java Function */\npublic double lda1_score(\n\tdouble sepal_width,\n\tdouble petal_width,\n\tdouble sepal_length,\n\tdouble petal_length)\n{\n\treturn (-2.6327927849795927 * sepal_width) +\n\t\t(-2.8866042807415337 * petal_width) +\n\t\t(-0.1287085383432931 * sepal_length) +\n\t\t(1.3054554747866476 * petal_length);\n}\n" }}{ "statusCode": 400, "statusString": "language must be specified in request", "values": {}}{ "statusCode": 500, "statusString": "Generic Exception [java.lang.Exception: Error cannot get code for language:xml]", "values": {}}Import model POST
Imports a model previously exported via `GET /model/export`. Note the path segment is singular `model`. The request body is the raw AES-encrypted, base64-encoded export blob (the literal `values.string` value from the export response) as the body, decrypted server-side with the customer's key.
Delete model DELETE
Next Page