Create a function

post/functionCategories/{categoryId}/functions
Internal-Use Only

Creates a new function in a specific category.

Request Samples

1

Response Samples

1{
2 "creationTimeStamp": "2020-08-04T17:46:19.097Z",
3 "modifiedTimeStamp": "2020-08-04T17:47:28.848Z",
4 "createdBy": "brmdev",
5 "modifiedBy": "brmdev",
6 "version": 1,
7 "id": "26674236-bc80-41de-954d-d37b1a19d98d",
8 "categoryId": "85329ae9-52df-444f-8e18-bffb1a523da7",
9 "name": "customadd2",
10 "code": "method customAdd2(double a, double b) returns double; return a + b; end;",
11 "returnType": "double",
12 "signature": [
13 {
14 "type": "double",
15 "name": "a",
16 "inOut": false,
17 "nameQuoted": false
18 },
19 {
20 "type": "double",
21 "name": "b",
22 "inOut": false,
23 "nameQuoted": false
24 }
25 ],
26 "links": [
27 {
28 "method": "GET",
29 "rel": "self",
30 "href": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d",
31 "uri": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d",
32 "type": "application/vnd.sas.business.rule.function"
33 },
34 {
35 "method": "PUT",
36 "rel": "update",
37 "href": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d",
38 "uri": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d",
39 "type": "application/vnd.sas.business.rule.function"
40 },
41 {
42 "method": "DELETE",
43 "rel": "delete",
44 "href": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d",
45 "uri": "/businessRules/functions/26674236-bc80-41de-954d-d37b1a19d98d"
46 },
47 {
48 "method": "GET",
49 "rel": "up",
50 "href": "/businessRules/functions",
51 "uri": "/businessRules/functions",
52 "type": "application/vnd.sas.collection",
53 "itemType": "application/vnd.sas.business.rule.function"
54 },
55 {
56 "method": "GET",
57 "rel": "category",
58 "href": "/businessRules/functionCategories/85329ae9-52df-444f-8e18-bffb1a523da7",
59 "uri": "/businessRules/functionCategories/85329ae9-52df-444f-8e18-bffb1a523da7",
60 "type": "application/vnd.sas.business.rule.function.category"
61 }
62 ],
63 "hidden": false,
64 "nameQuoted": false
65}

Path Parameters

NameTypeRequiredDescription
categoryId
string
true

The ID of the category in which to create the new function.

Request Body

The function to create.

A new reusable DS2 method with additional metadata.

Example:
{"code":"method custom_add(integer bar, double baz, in_out double foo);\n foo = bar + baz;\nend;","description":"Sums two numbers."}
NameTypeRequiredDescription
description
string
false

A description of the function.

signature
array [Function Signature Term]
false

An ordered array of the input parameters to the function determined by parsing the function's code.

code
string
true

The DS2 function implementation, starting with the method my_func(); statement.

testCustomContextUri
string
false

The URI of a Custom Context DS2 code file that provides a custom context to this function. Normally, this function's custom context is provided by the decision that utimately utilizes it. For syntax validation purpose, you can specify a testing-only custom context.

Responses

StatusMeaningDescription
201CreatedA new function category was created.HeadersSchema
400Bad RequestThe request was invalid.Schema