Image Blog API Script Execution Policy Manager
April 20, 2018

What Is an API Script? Overview, Execution, & More

Developer Portal

API scripts help you accelerate delivery. But what's the difference between an API vs. script? What does an API script do? And how can you build and execute API scripts faster?

That's what we break down in this blog. 

Back to top

API vs. Script

An API is a set of predefined requests that serve allows you to build an application from existing resources. A script is a set of programming that executes on an existing interface. But APIs and scripts aren't mutually exclusive. You can use API scripts to accelerate execution. 

Back to top

What Is an API Script?

An API script is an application programming interface (API) that interfaces between an application and scripting language. It provides the connection points with the application that allow you to control it.

Let's take a look at the phase of development that happens after creating APIs. It is at this stage that you are likely at a point where you have already defined the application elements that will “feed” your API. And you are looking for a way to quickly and efficiently use your API as the hub for inter- and intra-application communication and execution. 

👉  Learn more about the API lifecycle. And become an expert on API basics.

After you've properly configured your script, your next steps are:

  • Addressing the reference script.
  • Executing the API script.

In this blog, we'll share specifically how you do this in the Akana API platform. Akana provides the easiest way to accelerate digital transformation in the enterprise. With Akana, you can deploy APIs and API scripts faster, strengthen security, and partner with digital transformation strategy experts. 

Back to top

How to Address the Reference Script For APIs

Here's how to address the reference script for APIs by using the Akana API platform:

  1. Add your set of utility scripts.
  2. Add a script activity.
  3. Import a predefined script.
  4. Add a script reference for the function you want to perform.

For example, you may have API requirements like validating some data as part of your process. You created a reusable script (e.g., TestScript) that includes a function for validating data (validateData). In your process definition, import "TestScript" and reference the function in the script source as shown here:

Script Details 2
Back to top

How to Execute Your API Script

Here's how to execute your API script using the Akana API platform:

  1. Use script activity to execute a script at the point in the process the activity is connected.
  2. Write the script in either JavaScript, Jython, or BeanShell. You can do this in the script details editor in Akana, under the Source area. 

    Script Source

     

  3. Save common functions that you may need to perform in your scripts under script objects. This enables you to import functions and scripts to use in the future. 
  4. Use predefined variables to accelerate API script execution.

Here are the predefined variables in Akana that help you accelerate API script execution.

API Script Predefined Variable Cheat Sheet

Predefined Variable

What It Does

processContext

Provides functions for retrieving and changing information about the currently running process, such as the variables defined in the process and the authenticated subject(s) of the process.

systemLog

Provides logging functions to the container’s log. The statements logged with this interface are mixed with the other system log statements.

auditLog

Provides logging functions to the process audit log. If auditing is enabled for the virtual service operation that is invoking the process statements logged using this variable log information will be inserted into the audited message log for the operation’s execution. This can be found on the service’s monitoring tab in the logs sub-tab.

alerter

Provides an interface for generating alerts that are displayed in on Akana alert pages.

recorder

Provides an interface for recording content in Akana usage log pages.

msgFactory

Providers functions for create message variables. A message variable cannot simply be assigned content like a simple string or int variable. It must be initialized using one of the functions in the msgFactory.

 

Tip: Use Interfaces and Classes

Akana also provides a series of interfaces and classes you can use to build process-related scripts. The API below includes lots of use cases and sample code you can experiment with. You can use this as a baseline when building your own scripts.

Interfaces and Classes
Back to top

Improve Your API Scripts With Akana

Akana accelerates the API scripting process. That's because Akana enables you to create reusable reference scripts and accelerate API script execution.

The speed with which you can use Akana is why countless enterprises around the world trust the platform. Akana makes it easy to accelerate digital transformation in the enterprise, with fast API delivery.

See for yourself what sets Akana apart.

▶️ Watch the Demo

 

Back to top