Skip to main content

Execute Function

This section describes how to execute a JDE BSFN/NER using the function request web service.

The following are required:

  • Your application must have obtained a Cantara session ID. If not, review the User Sessions topic before continuing with this section.
  • The call you are making has already been defined using the Cantara Console. See Managing Functions, for more details.

A function can be executed by calling the service below with a payload that follows the Function Request definition (at a minimum the payload requires a function name and parameter). If the execution is successful, Cantara returns a response that follows the Function Response definition. If there is a failure, Cantara returns an error. See the Error Messages topic for more information.

Each function request requires one or more parameters based on their definition on the Cantara server (see Managing Functions). Although there may be multiple parameters defined for functions, only the parameters marked as Required need to included in the payload.

XML
URL: http(s)://[hostname]:[port]/[context]/service/[version]/function/[environment]
Request-Method: POST


Note:

Environment refers to the Cantara Access Server environment you are trying to log into. For example, E1PROD. You would have previously configured this when you set up your environment. Refer to the Managing Environments topic for more details.

You can obtain a list of configured environments by using the console to Managing Environments.

To review information about how to obtain the definition for a function, see the Obtaining Request Definitions topic.

Executing a Function Example

In this example the function GetQuantityAvailable is called by passing a payload that contains the branch/plant and short item number of the balance you wish to receive.

The function definition from the Cantara Administration Console is:

Content-Type: application/json

Request Payload

JS
{
	"Parameter":[
		{
			"value":"M30",
			"name":"branch"
		},
		{
			"value":"60011",
			"name":"shortItemNo"
		}
	],
	"name":"MyFunction"
    "tenantId": "123456",
    "apiKey": "AAA000-0000-0000-AAAA-A0A0A0A0A0",
    "cantaraVersion":"5.0"
}

Request Response

JS
{
	"Parameter": [
		{
			"value": "M30",
			"name": "branch"
		},
		{
			"value": "6074",
			"name": "branchAddressNo"
		},
		{
			"value": "00200",
			"name": "branchCompany"
		},
		{
			"value": "  ",
			"name": "branchCostCenterType"
		},
		{
			"value": "Eastern Manufacturing Center",
			"name": "branchDescription"
		},
		{
			"value": "60011",
			"name": "shortItemNo"
		},
		{
			"value": "Mountain Bike, Red",
			"name": "shortItemNoDescription"
		},
		{
			"value": "",
			"name": "shortItemNoDescription2"
		},
		{
			"value": "210",
			"name": "shortItemNoItemNumber"
		},
		{
			"value": "210",
			"name": "shortItemNoSecondItemNumber"
		},
		{
			"value": "210",
			"name": "shortItemNoThirdItemNumber"
		},
		{
			"value": "EA",
			"name": "shortItemNoUomPrimary"
		},
		{
			"value": "EA",
			"name": "shortItemNoUomSecondary"
		},
		{
			"value": "",
			"name": "lot"
		},
		{
			"value": " ",
			"name": "lotStatus"
		},
		{
			"value": "Add Lot Status Codes here",
			"name": "lotStatusDescription"
		},
		{
			"value": "",
			"name": "lotStatusDescription2"
		},
		{
			"value": "",
			"name": "lotStatusSpecialHandling"
		},
		{
			"value": "126",
			"name": "qtyAvailable"
		},
		{
			"value": "",
			"name": "location"
		},
		{
			"value": "  .   .",
			"name": "locationFormatted"
		}
	],
	"Message": {
		"value": "Transaction Successful",
		"type": 0,
		"sessionId": "6790.1500249203.23",
		"cantaraSid": "899a80b6-a5ef-49b3-83cc-c60102f01f4a"
	},
	"name": "MyFunction"
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.