APIX VSCode IDE Plugin for Node.js
What is APIX?
The APIX platform helps Financial Institutions and FinTechs innovate and collaborate solving business problems towards financial inclusion.
Visit APIX Platform for more details.
Marketplace:
Discover a new community to experiment and collaborate with.
- Catalogue of vetted Financial Institutions and FinTechs
- Search through a vetted product catalog of APIs and solutions
- Easily post a problem statement privately or publically
- Contribute an idea, API or solution to a business problem
- Track and follow contribution and activity through your homepage
Sandbox
Easily and quickly Design an API/solution for Deployment
- Subscribe and try out Sandbox APIs via a GUI to easily understand
- Use the Sandbox IDE to quickly build solutions using subscribed APIs
- View comprehensive documentation and support for each API
- Access APIs and functionality belonging to subscribed solutions
- Share access to subscribed APIs seamlessly within all users
VSCode IDE Plugin
This Visual Code Plugin was designed to accelerate the innovation with the APIs published in APIX.
- Plugin can be used for Node.js only
- All the subscribed and published APIs, versions, endpoint details can be accessed through the plugin.
- Plugin will generate code to tryout the endpoints
Installation steps
- Open Visual Code. Go to
View
Menu > Extensions
- Search for
apix
- Select
APIX IDE
> click on Install
Create a Node.js project [OPTIONAL]
Download Install Node.js
from official website
Open Terminal
application
Browse to your preferred path to store your Node.js project
cd ~/Desktop
mkdir my-project
cd my-project
Execute below command and provide the project details.
npm init
Open your Node.js project my-project
in Visual Code
Open New Terminal
window from Terminal
menu.
Execute below command to install swagger-client
npm dependency.
npm install --save swagger-client
Open APIX IDE Extension
Click on Configure
button from the toolbar and click Configure Credentials
.
Provide domain
, username
, password
information in the input dialog. Credentials will be encrypted and saved to apix.json
in the project root folder.
Click Refresh
button in the APIX IDE Extension.
If the provided credentials are correct and if you have any published or subscribed APIs in APIX, API list should get listed now.
Using extension to try-out APIs
View an code Example
- Click on
Add index.js
button which will create a index.js file with an example in your Node.js project.
Generated Code Sample is as below.
let Swagger = require('swagger-client');
exports.handler = function (event, context, callback) {
Swagger.http({
url: 'https://services.apixplatform.com/api-sandbox/application/token',
method: 'post',
query: {},
headers: { "Accept": "*/*", "Content-Type": "application/json" },
body: JSON.stringify({
"userName": "<EMAIL>",
"password": "<PASSWORD>"
})
}).then((response) => {
var access_token = "bearer " + response.body.access_token;
// Insert new API calls here to call with APIX Access Token
callback(null, access_token);
}).catch((err) => {
console.log(err);
callback("Execution failed");
});
}
Generate Code for a API endpoint
- Open the file and put the cursor to the place where you want to insert the generated code.
- Expand the API > Version > Endpoint and select the method to generate the code.
- Click on the arrow next to the method to generate the code.
- Code will be generated and added to the working document where the cursor was.
Change the generated code with header
, query
, body
, path
parameter values.
Save the file.
Run code with below command.
node <filename>
ex:
node index.js
Generate Code for APIX Token generation
- Open the file and put the cursor to the place where you want to insert the generated code.
- Go to the APIX IDE Extension
- Click on the
Key
icon in the toolbar.
- Code to get the APIX token will be generated and added to the working document where the cursor was.
Add External APIs
External APIs which are not available in APIX can also be linked to this extension by following below steps.
Open APIX IDE Extension
Click on Configure
button from the toolbar and click Add External API
.
Provide API Name
, API Specification
information in the input dialog. Provided details will be saved to apix.json
in the project root folder.
EXTERNAL APIS
section will populate the added external APIs with API Endpoints and Methods. Code can be generated using the same methodology described in the previous section.
Create New Projects
New Projects can be created in the IDE by following below steps.
Note: Code is generated through open source code generation tools and APIX has no responsibility with any issues related to code generators.
Open APIX IDE Extension
Click on Configure
button from the toolbar and click Create New Project
.
Select Language/Framework for the new project.
Provide project creation inputs in the terminal.
Git Integration
Follow the steps below to integrate IDE code with your git repo.
You will need to have your git setup url, username and password handy before following the steps listed below:
Initialize git by executing command git init
Setup config to tell git who you are by executing the commands:
- git config --local user.email "youremail@example.com"
- git config --local user.name "Your Name"
Add and commit initial set of files by running the command
- git add -A && git commit -m "Your Message"
Set linking of the remote origin by executing the command
- git remote add origin https://username@github.com/.../git-repo-name.git
Finally push your changes to the remote git by executing the command
- git push -u origin master
You will be asked to feed in your credentials before push. Once authenticated your changes will be pushed to the specified remote git repository and you are all set to explore!