Browse Category by Postman

Using Postman to test REST APIs

When testing SOAP web services almost everyone uses SOAP UI. In terms of REST APIs testing I like to use Postman instead. In this post I am going to show what you can achieve or do with Postman that is available as a Chrome App or Mac App.

  • Storing REST calls in collections
By clicking Save button in the right hand side you can store the requests you are working on.

You can store them in collections. You can also create folders inside those collections.

Collections can be shared or downloaded as a json file.
  • Manage environments
Environments holds variables that can be used in a request.
You can have as many environments as you want. There is an option to also create global variables that applies to your requests although you don’t have any environment selected.

This is an example of my MCS environment.

Having a variable called ‘MobileBackendId’, you can use it in the request like this: {{MobileBackendId}}
  • Executing pre-request scripts
You can also execute a script before a request is done. In this example, instead of changing the date before each request, you can create a script that fills currentDate variable with the system date and also formats the date.

  • Create tests
When a request is executed, you have a way to know if it is working fine without having to look the response.
For example I have created 2 tests:

  • If the body contains ‘message’ property.
  • If the response code is 202.

After executing the request you will see if the tests has passed or not.

ADF 12.2.1: Publish and secure ADF Business Components as REST services

In ADF 12.2.1, released just before OOW, many new features were introduced, and one of them is to expose ADF Business Components as REST Web Services. You can check other ADF 12.2.1 features in my ADF 12.2.1 release post.
In this post I am going to publish and secure ADF BC as REST services.

The first thing we have to do is to configure a release version for REST. You can do this in adf.config.xml file.

In previous versions we could expose BC as SOAP web services in Application Module Web Services tab, and now we can choose also REST.
We can select the view instances and set a resource name.

A xml file will be automatically created where for example we can set the attributes we want to expose and also if we want to expose any custom methods that we have created in the view implementation classes.

A new project will be also created in our application RESTWebService. This is the project we have to deploy. Simply click on the project and click on run.

If we test the service with any client tool, for example, Postman, we can see that the service returns Departments data.

The next thing we are going to do is to secure the services. We have to configure ADF Security.

In the configuration wizard RESTWebService project must be selected.

After finishing the wizard we have to secure the resource by adding some roles or users.

The last step is to configure the rest URL pattern in web.xml file, under security tab.

Now we are ready to test. If we don’t set any authorization in the rest call we can see that a “401 – Unauthorized” is returned.

But if we configure HTTP basic authentication, Departments data is returned.