REST Inference

This brief tutorial will walk you through the schema inference function.

We'll start out by creating a new project, and adding a REST service, without an initial WADL file.

After sending the request, we can then use the responses to build our schema.

Demo Request

To demonstrate the principles we will use a demo request from the Flickr REST example .

The request (when successful) returns a response in the following format:

<rsp stat="ok">

Note: The API key changes, so you may need to visit the Flickr REST demo site and get an up to date API key.

Creating The Project And Service

Getting the request into a REST project is easy:

  • Select File | New | Functional Test.
  • Select the URL option.
    Choose URL
  • Paste the URL mentioned above and click Next.
  • Ready! API will offer you to run the test, or create a data-driven test. Close the dialog, since we do not need either option yet.

The project is created and added to the workspace:

Project created

The parameters from the request URL is extracted automatically, and can be viewed in the form editor.

Request And Response

Now we have a request to work with:


The request holds all the parameters defined in one of its ancestors. The parameters have been pre-populated using the default values.

We haven't sent the request yet, so the response is blank:


Schema Tab

The REST response view has a tab at the bottom called “Schema”. This is the inferred schema inspector.

  • Open the Schema tab.


No information has been logged yet.

Normally, we would want the process of resolving schema conflicts to be automated. But for demonstration purposes we will take the manual route this time:


  • Make sure that Auto-Resolve is disabled.

Get Response

  • Click Run

The request is sent, and we get a response back:


Note: The API key changes, so you may need to visit the Flickr REST demo site and get an up to date API key.

The Schema tab changes to indicate that schema conflicts have occurred:


This means that the analysis of the response has indicated that there are conflicts between the current response and the previously inferred schema. In this case, this is as it should be, as no prior schema exists.

  • Open the Schema inspector


We can now resolve the conflicts manually.

  • Click Resolve Conflicts

For each detected conflict, we will get a notification and can take action as needed.


In this case, we can assume all conflicts should be resolved (again, no previous schema).

  • Click Yes To All*

All conflicts are then automatically resolved, and logged in the Schema log:


Inferred Schema

When all conflicts have been resolved, the schema is added in the Schemas tab:


So far we can see one namespace, and the associated XSD schema for it. As this schema is based on only one response we can refine it by making some more requests. While doing so we should try to vary the responses so that they are as different as possible. For instance, we can issue an invalid request so that we can infer the schema for a fault, or make a request for a query that returns an empty result set, and so on.

Adding Definitions

More responses can be added to the Schema automatically, by simply sending a different request. Since we can assume that the responses will be valid, we can use the “Auto-Resolve” feature.

  • Go back to the Conflicts tab


  • Make sure that Auto-Resolve is enabled.

A Different Request

To get a different response, we need to change the request:


  • Remove the api_key value

This will ensure that we get an error response.

  • Click Run

The request is sent, and we get a response back:


This time, as conflicts occur they are resolved and logged automatically:


Updated Schema

When all conflicts have been resolved, the new response is included in the schema in the Schemas tab:


The new response has been included in the schema:

Before After
Before Before

You can now keep modifying requests and build up your schema.

Help and Feedback

You did not find what you looked for?

© 2016 SmartBear Software

Didn't find an answer? Try searching here: