To create new project from OpenAPI data, select menu option
File/New Project from OpenAPI Data. The import window is opened where you have to specify the source of OpenAPI data; source can be URL address or disk file. If parsing is successful, application will display data in the following sections:
- General project data; contains project name, description, and global URL.
-
Request item list; contains complete list of operations obtained from OpenAPI data. Each operation represents single request item that will become part of HttpMaster project once created. Because request item names in the project must be unique, parsing procedure might append some string to particular name to guarantee uniqueness.
You can specify which request items (operations) will be included in created project by ticking corresponding checkboxes in the list.
-
Request item data; by selecting any item in the list, you can see its data in the right part of the window. This data has been extracted from OpenAPI definition of the corresponding operation and can be changed before the project will be created. The following data is available for request item:
- Operation id; this data is readonly and will be used for request item operation id. It is vital when updating existing HttpMaster project from new version of OpenAPI data.
- Name; will be used for request item name.
- Description; will be used for request item description.
- URL; can be absolute or relative. If relative path is specified, global URL in project properties must also be specified.
- Method; usually GET, POST, PUT, etc., but can be set to any value.
- Headers; each header must be specified on a separate line, name and value must be separated by a colon, for example, Accept: application/json.
- Content type; content type of the posted data, for example, application/json or application/x-www-form-urlencoded.
- Request data; data that will be posted.
When you have finished tweaking the data, click
OK button and new project will be created and opened in HttpMaster main window.
How request body is created
If request data for the operation is specified as
body, HttpMaster will obtain values of
consumes element and determine type of the body with the following procedure:
- If the first consumes value is one of the XML content types (application/xml, text/xml), HttpMaster will try to create XML body.
- If the first consumes value is JSON content type (application/json), HttpMaster will try to create JSON body.
- If type of the body cannot be determined, HttpMaster will try to create JSON body.
Connect OpenAPI parameters with HttpMaster project parameters
HttpMaster supports variety of parameter types which can be created in project properties. These parameters can be used to generate dynamic data for request item and can be used in URL, request body, or headers field. When these parameters are used, they must be enclosed in curly braces, for example,
{id}. Since OpenAPI parameters are also enclosed in curly braces, you can specify HttpMaster project parameters with the same name as used in OpenAPI data and they will be connected automatically.
Update existing project from OpenAPI data
If you have an existing HttpMaster project, you can create new request items from new OpenAPI operations or update existing project items with possible data changes in the corresponding OpenAPI operations. To update an existing project, open it in HttpMaster and select menu option
File/Update Project from OpenAPI Data. After successful OpenAPI data parsing, operations will be displayed in the following way:
- Operations that are not already part of the open project will be displayed in regular font and selected.
- Operations that are already part of the open project will be displayed in italic font and unselected. To see the possible differences between OpenAPI definition and the corresponding project request item data, you can review and compare OpenAPI data tab and Project item data tab.