Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Create Model Function

POST/api/v2/models/{modelRid}/function
Warning

This endpoint is in preview and may be modified or removed at any time. To use this endpoint, add preview=true to the request query parameters.

Creates a function for the model.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:models-write.

Path parameters

modelRid
string

The Resource Identifier (RID) of a Model.

Query parameters

preview
booleanoptional

Enables the use of preview functionality.

Request body

CreateModelFunctionRequest
object
Hide child attributes

Hide child attributes

apiName
string
ontologyBinding
stringoptional

The unique Resource Identifier (RID) of the Ontology. To look up your Ontology RID, please use the List ontologies endpoint or check the Ontology Manager.

isRowWise
boolean
displayName
string

Response body

ModelFunction
object

The created ModelFunction

Hide child attributes

Hide child attributes

functionRid
string
functionVersion
string
displayName
string
apiName
string
isRowWise
boolean
ontologyBinding
stringoptional

The unique Resource Identifier (RID) of the Ontology. To look up your Ontology RID, please use the List ontologies endpoint or check the Ontology Manager.

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ \t-H "Content-type: application/json" \ \t-H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/models/ri.models.main.model.f351c142-0e4c-4b12-adc2-6e1539737ae9/function?preview=true" \ -d '{"apiName":"myModelFunction","ontologyBinding":"ri.ontology.main.ontology.a1b2c3d4-e5f6-7890-abcd-ef1234567890","isRowWise":false,"displayName":"Core.DisplayName"}'

Response

Copied!
1 2 3 4 5 6 7 8 { "apiName": "myModelFunction", "ontologyBinding": "ri.ontology.main.ontology.a1b2c3d4-e5f6-7890-abcd-ef1234567890", "isRowWise": false, "functionVersion": "0.0.1", "displayName": "Core.DisplayName", "functionRid": "ri.function-registry.main.function.a1b2c3d4-e5f6-7890-abcd-ef1234567890" }

Error responses

Error Name
FunctionAlreadyExistsError CodeCONFLICT
Status Code409
DescriptionA function already exists for this model.
ParametersmodelRid
ModelApiTypeUnsupportedForFunctionError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe model API contains a data type that is not supported for Ontology function creation.
ParametersfieldName, unsupportedType
InvalidFunctionApiNameError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe provided API name for the function is invalid.
ParametersapiName
OntologyBindingRequiredError CodeINVALID_ARGUMENT
Status Code400
DescriptionAn ontologyBinding is required when creating or replacing a model function.
Parameters
OntologyNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe specified ontology was not found.
ParametersontologyRid
CreateModelFunctionPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not create the ModelFunction.
ParametersmodelRid
ModelNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe given Model could not be found.
ParametersmodelRid