SymetryML Documentation
Models

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.

GET
/{user}/projects/{project}/models/{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.

Authorization

SymetryMLAuth
AuthorizationBearer <token>

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*string

User/Customer identifier

project*string

Project identifier

model*string

Model identifier

Query Parameters

language*string

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": {}}