Create Project from OpenAPI Data

Help Topics
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.
Example
  • OpenAPI data contains operation getPetById with URL /pet/{petId}.
  • After HttpMaster project will be created, it will contain request item for this operation with the URL specified.
  • You can now create HttpMaster project parameter with the name petId and specify parameter value, for example, 1000.
  • When project changes will be applied, HttpMaster will connect created project parameter with request item getPetById because request item contains parameter with such name in its URL.
  • If you will now execute request item getPetById, it will use data 1000 for petId parameter.

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.
Important
The existence of an OpenAPI operation in the project is determined by searching OpenAPI operation ID of project request items; you can see OpenAPI operation ID value of particular project request item in its properties (displayed beside Item name value). If search by operation ID did not find a matching project request item, HttpMaster will try to find the corresponding project request item by its name. This can be useful if you are not using operation ID data in your OpenAPI definition.
Important
To hide operations that are already part of the project, open application options and turn on the option Hide parsed operations that are already part of the open project. For more information on application options, see the corresponding topic.