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. Name for the request item is determined with the following procedure:
    • If summary data is available for the operation, it is used for request item name.
    • If summary data is not available, operation id is used for request item name.
    • If operation id is also not available, internal generic name is used for request item name.
    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 name if summary data for the operation is not specified.
    • 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 existing HttpMaster project, you can obtain new request items from OpenAPI data and add them to the project. To update existing project, open it in HttpMaster and select menu option 'File/Update Project from OpenAPI Data'.