DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Configuring the Ground: How to Install and Configure an API Builder Data Connector

Configuring the Ground: How to Install and Configure an API Builder Data Connector

Learn how to install and configure an API Builder data connector.

Leor Brenman user avatar by
Leor Brenman
·
May. 27, 19 · Tutorial
Like (2)
Save
Tweet
Share
8.23K Views

Join the DZone community and get the full member experience.

Join For Free

API Builder is a key component of the Axway AMPLIFY Platform. You can use API Builder to create API microservices using an API-First approach or a data-connector approach with no or low code. Since API Builder supports Docker Containers natively out of the box and can run in any Docker infrastructure, it supports Cloud to Ground Hybrid Integration Platform scenarios.

In this blog post, we'll use API Builder Standalone and describe how to install and configure an API Builder Data Connector. We'll use the MongoDB data connector for this post.

If you don't already have a working API Builder project on your machine, head on over the Axway online docs and follow the API Builder Getting Started Guide.

Install MongoDB Connector

Follow these instructions to install the API Builder MongoDB Data Connector. Namely, use the CLI command in your terminal:

npm install -no-optional @axway/api-builder-plugin-dc-mongo

As you can see from the console log above, we need to configure the connector by editing the connector configuration file in the project/conf folder.

Configure the Connector

Edit the connector configuration file — mongo.default.js — in the project /conf folder. You can set the  generateModelsFromSchema and modelAutogen properties to true so that API Builder will create models from any collection in your database and expose the models as full CRUD APIs.

We also need to set the parameter to the MongoDB connection string for your instance. See the screenshot below for how to retrieve the connection string for my MongoDB Atlas managed instance (or for an on-prem MongoDB instance, use the appropriate connection string).

The connection string is shown below:

mongodb://admin:<password>@cluster0-shard-00-00-merks.mongodb.net:27017,cluster0-shard-00-01-merks.mongodb.net:27017,cluster0-shard-00-02-merks.mongodb.net:27017/test?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true

Note that you need to edit the password and also set the database name.

Once you've edited the connector configuration file, you can restart the API Builder project again using:

npm start

Test Your API

Now that the project is running, you can browse the API Builder Console in a browser at:

http://localhost:8080/console

Navigate to the "API Doc & Test" tab, as shown below:

My MongoDB database contains one collection: "dog". You can see the "mongo/dog" entry in the screenshot above.

Click on the API for your collection and see the full set of CRUD APIs, as shown below:

Click on the GET (FindAll) API to expand it and see the automatically-generated API doc, as shown below:

Press the Execute button to call the API and see the data in your collection:

Summary

In this blog post, we saw how easy it is to install, configure, and test a data connector for API Builder Standalone. Take a look at this video that covers this flow in real-time: https://www.youtube.com/watch?v=MknEOb8FjVM

After testing your API, you need to create a Docker Container using the Dockerfile that comes out-of-the-box in your API Builder Project. Then, you can deploy that container image in any Docker infrastructure.

API Connector (mathematics) Data (computing) Database Docker (software)

Published at DZone with permission of Leor Brenman, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Express Hibernate Queries as Type-Safe Java Streams
  • Select ChatGPT From SQL? You Bet!
  • Mr. Over, the Engineer [Comic]
  • Top Three Docker Alternatives To Consider

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: