Authenticating APIs with Okta and DreamFactory

DreamFactory Okta
DreamFactory Okta
In our previous blog we dove into OpenID Connect, now let’s take a look at Okta. DreamFactory’s Okta integration works flawlessly, providing rock solid security and easy identity management. Many developers wish to integrate Okta into their application authentication infrastructure, and DreamFactory offers a straightforward solution for doing so. It is time to simplify the way your users connect to apps.

As of version 2.8 DreamFactory has supported Okta allowing you to use Okta based authentication in conjunction with your APIs. With DreamFactory’s easy to understand web-based administration console, you can easily configure your application work-flow in a snap. DreamFactory and Okta simplify the way your users to connect so your team can spend more time on developing the things that matter.

It’s time to leave the days of pain and suffering of integrating complicated authorization in the past for the future of development with DreamFactory. If you would like to learn more about how easy it is and see it in action, check out our guide chapter dedicated to all things authorization. What are you waiting for? Spin up for a free trial today!

NoSQL vs SQL: Understand the Differences and Make the Best Choice

nosql vs sql
NoSQL vs SQL
The tough choice of NoSQL vs SQL. An important decision for any business that may pay the price for down the road if you don’t plan accordingly. Here, we break down the important distinctions and discuss NoSQL vs SQL for you to make an informed decision.

What is NoSQL

NoSQL or Not Only SQL is an alternative to relational databases such as MySQL, Postgres, and SQL Server. Typically NoSQL databases are popular for working with large sets of data as data is stored in the form of flat collections so reading or writing operations is much faster. There is also less management for NoSQL databases as they support automatic repair, data distribution, and simpler data models. MongoDB, Couchbase, and Cassandra are popular NoSQL databases, but what do their queries look like? If NoSQL is all about leaving SQL behind, then what happens? These are fair questions, for example MongoDB uses its own syntax that kind of resembles JavaScript. Let’s take a look:
db.inventory.find( { status: "D" } )
In the above query the example selects from the inventory collection all documents where the status equals “D”. It is not too difficult to follow, but does feel a little foreign if you are used to SQL.

What is SQL

SQL or Structured Query Language is a language used in programming and designed for managing data held in a relational database management system. Some examples of popular SQL databases are Microsoft SQL Server, MySQL, and Postgres. One of many reasons for its popularity is how portable it is. SQL can be used in the program in PCs, servers, laptops, and even some of the mobile phones. Unlike NoSQL databases, SQL databases have an established, well defined standard. The language is also very straightforward, let’s take a look at it:
SELECT * FROM inventory WHERE status = "D"
In the above query the example selects from the inventory collection all documents where the status equals “D”. Sound familiar? That is because it is doing the same thing the MongoDB query is doing.

Which is Better?

This all depends on what your goals are. SQL databases tend to be beneficial for companies that have a clear business structure and do not plan on making many changes to their database structure. If your company has rapid growth or no clear schema definitions then a NoSQL database is the right choice for you. If you’re uncertain about which type of database is best for your business, you can schedule a consultation with one of our experts today.

What if you want to use a SQL database but not learn SQL or the opposite, use a NoSQL database without learning how to handle the data? That is where DreamFactory comes into play, interact with your data without having to learn SQL. In minutes generate an API from nearly any datasource that is fully documented and secure without code. Contact an expert today to learn how to cut development cost and time in half.

Monitoring APIs with Grafana

.imagedropshadow, iframe {
border: solid 1px #EFEFEF;
}

DreamFactory, Prometheus, Docker, and Grafana
DreamFactory, Prometheus, Docker, and Grafana

Now that we have explored monitoring apis with Prometheus, lets take a look at monitoring our APIs with Grafana. You may have noticed from the previous blog that Prometheus is awesome, but takes some time to fully flesh out and their dashboards aren’t the best. Good thing Grafana specializes in data visualization. We will not even have to configure all our Prometheus queries, so let’s get started.

Continue reading “Monitoring APIs with Grafana”

Creating a Microsoft SQL Server API in Less Than 5 minutes with DreamFactory

DreamFactory and Microsoft SQL Server
DreamFactory and Microsoft SQL Server

Do you have a ton of data sources and do not know how to expose them? Do you know you need a Microsoft SQL Server API but don’t know where to begin to build it? Look no further, DreamFactory can take any database and generate a fully documented and secure REST API faster than making a sandwich. All you need is your database credentials and DreamFactory will handle the rest, instantly generating Swagger documentation and securing your API by way of API keys. Follow along with the blog or our video below!

Installing DreamFactory

In order to get started you must install DreamFactory, which is Open Source and gives you the ability to try out a numerous amount of popular databases. To spin up your own hosted environment for free click here.

Did you know you can generate a full-featured, documented, and secure Microsoft SQL Server REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example database provided to you as part of the trial!

Create a Microsoft SQL Server REST API Now

Generating the SQL Server API

Now the fun part. Once you have DreamFactory up and running you will be on the Admin panel. From there you will navigate to the Services tab to connect your database for your API. For example I have selected a Microsoft SQL Server database but it is nearly identical for any database you will be connecting to. Connecting your database typically only requires filling out these 5 fields as shown below.

SQL Server API

Upon saving there will be a success window pop-up saying “Service saved successfully”. What it doesn’t tell you is all the magic it just did behind the scenes. In just that short amount of time, it generated your REST API. So now if you navigate to the API Docs tab you can see your new documentation for the API and actually interact with it via the “Try it out” button.

SQL Server API

Securing and Interacting with the API

I can end it here now that you have generated your API, but where is the fun in that? Now let’s actually see the API in action! First things first, let’s generate an API key to be paired with the API for security purposes. DreamFactory does not allow access to the API without being authenticated. Let’s navigate to the Roles tab and create a Role for our API. This Role with correspond with the API key so different users can have different privileges based off different keys.

SQL Server API

For my Role I have pointed it to the SQL Server Service we just created and told it to only allow GET calls on the endpoints. This will ensure anyone using this API key will not be able to, for example delete data from the database. We must now link this Role to an API key. If we now go to the Apps tab we can create a new API key with the corresponding Role.

SQL Server API

Once we hit save we are able to see the API key generated for our use. Just to show how it works I will be using Insomnia, a popular HTTP service, to call our DreamFactory API. I will call the customers table, passing the API key in the headers for authentication.

SQL Server API

Did you know you can generate a full-featured, documented, and secure Microsoft SQL Server REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example database provided to you as part of the trial!

Create a Microsoft SQL Server REST API Now

Conclusion

As you can see I have access to our new API and how much time did that take? Way less time than building this API yourself! If you would like to find out exactly how much time and money DreamFactory can save you, check out our API calculator. Otherwise what are you waiting for? Go build your next application using DreamFactory already!

If you have any questions about the platform, or just APIs in general, we’d love to hear from you! Contact us.

7 Simple REST Client Examples for Retrieving API Data

You’ve installed DreamFactory and connected to your database, and executed a few test API calls in the API Docs interface. So what’s next? Fortunately DreamFactory has already taken care of autogenerating your API endpoints so you can skip right past that and proceed to creating a client which will talk to the DreamFactory-managed API.

In this article we will demonstrate seven simple REST client examples involving sending a GET request to an HTTP-based API using an API key for authentication. We will present examples demonstrating NodeJS, Python, Ruby, PHP, and Perl. Even if you’re not a DreamFactory user (you should check it out, our OSS version is available for free download) there’s still plenty to learn from this post!

Continue reading “7 Simple REST Client Examples for Retrieving API Data”

API Cost Calculator: How Much Does it Cost to Build an API?

.imagedropshadow {
padding: 5px;
border: solid 1px #EFEFEF;
}

You need to save money, deploy projects faster, and spend more time on developing application experiences that enthrall users. It is practically a certainty that APIs will play a critical role in your software development process, but how much does it cost to build an API?

It’s important to understand that there is more to an API than just coding an interface to some data source. Whether you are planning on hiring a contractor or assigning a new project to your team, an API calculator can help you understand the time and cost required to develop a mission-critical part of your next project.

Continue reading “API Cost Calculator: How Much Does it Cost to Build an API?”

SOAP vs. REST APIs – Which Reigns Supreme?

SOAP vs REST
SOAP vs REST

These days it’s more true than ever that “no company is an island”. Many businesses rely on each other by exchanging information and much of that exchange is done via an API. When diving deeper into the question of developing APIs, you’ll undoubtedly encounter the question: SOAP or REST? Although REST APIs have become the most popular choice for today’s businesses, the decision isn’t always an easy one.

In this article, we’ll go over everything you need to know about SOAP and REST APIs. That way you can come to the conclusion that’s ultimately right for your situation.

Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example database provided to you as part of the trial!

Create a REST API Now

What is an API?

There are a lot of definitions of the term “API” out there, and many can be confusing. An API (Application Program Interface) is a way for you to get information needed in a consistent format.

You can think of an API as like an interaction between a business and a customer, such as placing an order at a restaurant.

  • Customers first read the menu, then they decide what food they would like to order.
  • The waiter serves as the “middleman” between the customer and the business. They take the request and present it to the business in a way that’s most comprehensible and efficient.
  • The business reviews the request and sends back a response to the customer, such as a plate of food.

It’s important to note that in this example, the interaction is entirely predictable. When customers go to a restaurant, they can assume that they’ll be handed a menu. Then use that menu to place an order, and receive the food they ordered.

In the same way, APIs offer consistency to users who want to query a website for its data. By establishing a common set of rules for exchanging information, APIs make it easier for two parties to communicate.

What is a SOAP API?

SOAP (Simple Object Access Protocol) is an API protocol that uses the XML Information Set specification in order to exchange information.

SOAP vs REST

A standard SOAP message consists of the following XML elements:

  • An Envelope element that identifies the document as a valid SOAP message
  • An optional Header element that specifies additional requirements for the message, such as authentication.
  • A Body element that contains the details of the request or response.
  • An optional Fault element that contains information about any errors encountered during the API request and response.

What is a REST API?

REST (Representational State Transfer) is an architectural style for APIs that relies on the HTTP protocol and JSON data format to send and receive messages. REST utilizes CRUD (Create, Retrieve, Update, and Delete) to keep API calls as simple as possible to understand. With its simplicity, developers can understand it whether they are the lead architect or a junior developer just starting.

SOAP vs REST

As highlighted by BBVA some major advantages to REST Visibility, reliability and scalability. REST is very simple to scale and can be reused across several projects. This provides you with the advantage of faster development cycles with far less headaches. It also is independent from being bound to a single language, meaning you can use it with any language such as PHP, JavaScript, or Python.

The Pros and Cons of SOAP and REST

When comparing REST and SOAP, people often use the analogy of a postcard and an envelope. REST is like a postcard in that it’s lightweight and consumes less bandwidth (paper). Meanwhile, SOAP is like an envelope: there’s an extra overhead required on both ends to package and un-package it.

Note that the analogy isn’t perfect: unlike a postcard, the content of REST requests and responses isn’t (necessarily) insecure. Instead, REST uses the security of the underlying transport mechanism, which is usually HTTPS. On the other hand, SOAP implements its own security measure, which is known as WS-Security.

Some people believe that REST is largely a “replacement” for SOAP, due to its lower overhead and improved ease of use. According to Cloud Elements’ 2017 State of API Integration report, 83 percent of APIs now use REST, while only 15 percent continue to use SOAP. Some of these businesses primarily use REST, but continue to integrate SOAP APIs into their projects using tools such as DreamFactory’s SOAP connector.

However, the thought of SOAP being outdated isn’t quite accurate. Even as REST becomes the API style of choice for most businesses, SOAP remains a tool that is better-suited for certain use cases, mainly in large enterprises who need additional extensibility and logic features native to the protocol.

The advantages of REST include:

  • Flexibility: Although REST is most commonly implemented with HTTP and JSON, developers are by no means obligated to use them. Websites can send back responses using data formats including JSON, XML, HTML, or even plaintext-whatever best suits their needs.
  • Speed: Because it tends to use much less overhead, REST APIs are typically significantly faster than SOAP. While the differences might be imperceptible for a single request, the disparity grows larger and larger as you place more and more requests.
  • Popularity: REST has reached critical mass on the Internet. Major websites such as Google, Twitter, and YouTube all use REST APIs for users to send and receive messages. Due to this familiarity, it’s typically easier for developers to get up and running with REST.
  • Scalability: Thanks to their speed and simplicity, REST APIs usually perform very well at scale.

Despite the major benefits of using REST, SOAP remains the preferred protocol in certain use cases. Some organizations find that SOAP offers the transactional reliability that they’re looking for, while others simply continue to use SOAP because they need legacy system support.

The advantages of SOAP include:

  • Formality: SOAP can use WSDL (Web Services Description Language) to enforce the use of formal contracts between the user and the website. SOAP is also inherently compliant with ACID database standards, which ensures that the transactions it performs will be valid even in the event of errors or hardware issues.
  • Logic: If a REST API request is unsuccessful, it can only be addressed by retrying until the request successfully goes through. On the other hand, SOAP includes built-in successful/retry logic so that the requesting system knows how to behave.
  • Security: SOAP comes with its own security mechanism, WS-Security, built into the protocol. If you want to ensure that your messages are secure, rather than relying on the underlying transport mechanism as does REST, then SOAP may be the right choice.
  • Extensibility: In addition to WS-Security, SOAP includes support for other protocols such as WS-Addressing and WS-ReliableMessaging that can define other standards of communication and information exchange.

Converting SOAP to REST

SOAP to REST

DreamFactory can convert your SOAP service to REST in minutes. If you have your SOAP service RESTified you can take advantage of the features DreamFactory provides. Like turning security up 10 notches by securing the API with API Keys and Roles to only allow access to people that have the right to it. Even add custom events and business logic by way of our powerful Scripting engine.

Conclusion

For most cases, REST should be considered the “default” option as adoption continues to grow across the web. Most public-facing APIs now use REST, because it consumes less bandwidth and its compatibility with HTTP makes it easier for web browsers to use.

However, you may find that the additional features and security offered by SOAP are enough to sway your decision. In the end, the “right” choice between SOAP and REST will be highly dependent on your own situation.

Even better, the choice of SOAP and REST doesn’t have to be between one and the other. If you want to communicate with REST but still need access to legacy SOAP services, DreamFactory offers the ability to add a REST API onto any database or SOAP API.

See how quick and easy it is!

 

If you have your SOAP service RESTified we can take advantage of the features DreamFactory provides. Like turning security up 10 notches by securing the API with API Keys and Roles to only allow access to people that have the right to it. Even add custom events and business logic by way of our powerful Scripting engine.

If you know REST APIs are the best for you, don’t waste any more time building them. Try it yourself with your own instance of DreamFactory or connect with an API specialist today!

Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example database provided to you as part of the trial!

Create a REST API Now

Filtering Related Columns within DreamFactory REST API Queries

Consider a query which joins employee records found in an employees table with information about their assigned department, the latter of which resides in a table named departments. The relationship is formalized using a key named emp_no. When DreamFactory parses the schema it will create aliases for each relationship, including one for the above-described named something like dept_emp_by_emp_no. The join query will therefore look like this:
/api/v2/mysql/_table/employees?related=dept_emp_by_emp_no
This would yield a JSON response containing records that look like this:
{
  "emp_no": 10001,
  "birth_date": "1953-09-02",
  "first_name": "Georgi",
  "last_name": "Facello",
  "gender": "M",
  "hire_date": "1986-06-26",
  "birth_year": "1953",
  "dept_emp_by_emp_no": [
    {
      "emp_no": 10001,
      "dept_no": "d005",
      "from_date": "1986-06-26",
      "to_date": "9999-01-01"
    }
  ]
},
If you wanted to limit the related fields to just dept_no and from_date, you would add dept_emp_by_emp_no.fields to the parameter list:
/api/v2/mysql/_table/employees?related=dept_emp_by_emp_no&dept_emp_by_emp_no.fields=dept_no,from_date
This query would yield records with the following structure:
{
  "emp_no": 10001,
  "birth_date": "1953-09-02",
  "first_name": "Georgi",
  "last_name": "Facello",
  "gender": "M",
  "hire_date": "1986-06-26",
  "birth_year": "1953",
  "dept_emp_by_emp_no": [
    {
      "dept_no": "d005",
      "from_date": "1986-06-26"
    }
  ]
},
You can learn more about working with related data inside DreamFactory on our wiki: http://wiki.dreamfactory.com/DreamFactory/Features/Database/Related_Data#Getting_the_Related_Data.

Instantly Create a SQL Server REST API

Need access to SQL data from your mobile, web or IoT apps?

To have an easy and secure way to add a SQL Server REST API to any SQL database in minutes, we are going to show how you can use DreamFactory to do just that. Use the DreamFactory platform to connect your database, utilizing nothing more than your database credentials, then DreamFactory auto-generates a REST API for your SQL database – it’s that simple!

In this blog post we’ll show how to REST-enable any SQL database, including the creation of a SQL Server REST API. DreamFactory can REST-enable a huge range of databases and data sources including the most popular platforms like MySQL and even Excel. We’ll also show some simple examples of how to use the REST API to manage your SQL schema and data.

Continue reading “Instantly Create a SQL Server REST API”