Working Logic
Elements of the incoming message (header, parameter, body) are processed with the selected script language and the result is sent to the client.
Read and Write Rules
Changes cannot be made to the original form of the incoming request message, only reading can be done on this data. The response to be returned to the client is prepared within the script.
Creating New Script-2-API
1
Go to Script-2-API Page from Menu
Development → API Creator → Script-2-API item is selected in the main menu.

2
Create New API
The +Create button at the top right of the opened interface is clicked.
3
Fill API Information
Required fields for the new API to be created are filled and the →Save and Next button at the top right is clicked, starting the API creation process.

4
Add Endpoint
After the API is saved, endpoint definition for the API begins. If there is no endpoint, press the add button inside the API for the first time to add, if there is at least one, press the add button that appears in the endpoints section.

Endpoint Creation
The following information is entered to define an Endpoint:
Basic Information
Basic Information
HTTP Method
Field: HTTP MethodHTTP Method is selected for REST APIs: GET, POST, PUT, HEAD, OPTIONS, DELETE, PATCH, TRACE, ALL
Name/URL
Field: Name/URLEndpoint access address. When API Proxy is created, the endpoint is accessed through this address.
Description
Field: DescriptionDefinition information of the API endpoint.
Script Settings
Script Settings
Script Type
Field: Script TypeType of the Script to be written. Can be Javascript or Groovy.
Script
Field: ScriptInformation about the script to be executed.
Variables
Field: VariablesList of read-only and write-only variables that can be accessed in the request and response pipeline. When the relevant variable is clicked, the variable is added to the point where the cursor is located in the Script field.
Try Button
Field: Try ItOpens a new window to allow testing of the script to be executed.
Variables
Various keywords are used for access to message header, parameter, and body parts on script for read and write operations to be performed.Client → Apinizer (Request Data)
Client → Apinizer (Request Data)
Variables used to access data coming from client to Apinizer:
Header
Variable:
requestHeaderMapFromClientData Type: Map<String, String>Operation: ReadUsed to read request headers.Parameter (URL Parameter)
Variable:
requestUrlParamMapFromClientData Type: Map<String, String>Operation: ReadUsed to read URL parameters.Body
Variable:
requestBodyTextFromClientData Type: StringOperation: ReadUsed to read request body.Message Information (Context)
Variable:
contextValuesData Type: StringOperation: ReadUsed to access message information.Custom Variable
Variable:
customVariableMapData Type: Map<String, String>Operation: Read, WriteUsed to read and write custom variables.Apinizer → Client (Response Data)
Apinizer → Client (Response Data)
Variables used to create data to be sent from Apinizer to client:
Header
Variable:
responseHeaderMapToClientData Type: Map<String, String>Operation: WriteUsed to create response headers.Body
Variable:
responseBodyTextToClientData Type: StringOperation: WriteUsed to create response body.Status Code
Variable:
statusCodeToClientData Type: IntegerOperation: WriteUsed to set HTTP status code.Message Information (Context)
Variable:
contextValuesData Type: StringOperation: ReadUsed to access message information.Custom Variable
Variable:
customVariableMapData Type: Map<String, String>Operation: Read, WriteUsed to read and write custom variables.If script type is Groovy:
- JsonSlurper when message body is JSON
- XMLSlurper when message body is XML
Creating API Proxy from Script-2-API
After the API’s definitions are completed, it’s time to open this API as an API Proxy.At least one endpoint of the API created with Script-2-API must exist to create an API Proxy from Script-2-API.


You can create multiple API Proxies for one Script-2-API.
Deploy/Redeploy
You can manage the deployment status of API Proxies created with Script-2-API from the API Proxies page or by selecting the relevant API on the Script-2-API page. To manage from the Script-2-API page, use the window opened by clicking the Manage API Proxies link located at the top of the page. In the opened window, you can perform Deploy, Redeploy, and Undeploy operations for API Proxys created from this API. You can visit our Revision, Deployment, Redeployment, Undeployment pages for more detailed information on this topic.

When a new endpoint is added to Script-2-API or changes are made within an endpoint, all API Proxies created from this API must be redeployed for the changes to take effect.




Script-2-API Deletion
When a Script API is deleted, all API Proxies connected to it are first removed (undeploy) and then deleted.

