1. Docs
  2. Resources
  3. API Requests
  4. The API library

The API library: collections, folders and imports

The tree on the left of API Requests is the project’s API library. This page covers creating and organizing requests and bringing in existing ones from Postman, Swagger / OpenAPI or curl.

5 min read Updated CustomersAdmins

In short

On this page you can

  • Create requests, collections and folders in the API tree.
  • Rename, duplicate, move by drag and drop, and delete items.
  • Import a Postman collection JSON file.
  • Import a Swagger / OpenAPI spec from a file or a URL.
  • Turn a curl command into a filled request by pasting it.

How to use it

  1. Click More › Add Collection and name the collection.
  2. Select it and click New Request, or use the item menu › Add Request.
  3. Or import: More › Import Postman or Import Swagger / OpenAPI.
  4. Paste a curl command into Request URL to fill a request.
  5. Drag requests into folders; use the item menu to rename or duplicate.

Create a request#

  1. Pick where it goes

    Select a collection or folder in the tree. With nothing selected, the request goes to the top of the tree.

  2. Click New Request

    Click New Request above the tree, or Add Request in a collection’s or folder’s menu. The request is created as “New Request” (“New Request 1”, “New Request 2”… when the name is taken there) and opens in the middle.

  3. Name it

    The new name is ready to type in the tree. Later, click the name at the top of the request to change it, for example to “Create order”. Enter or leaving the field saves the name at once (“Name updated successfully”); Esc cancels. An empty name is not accepted.

  4. Fill and save

    Choose the method, enter the URL and body, then click Save. See Edit and send a request.

    “API data saved”. The tree shows the request with its method chip.

Collections and folders#

  • Collection: More › Add Collection. Collections stay in the order they were created.
  • Folder: More › Add Folder, or Add Folder in a collection’s or folder’s menu. Folders and requests are sorted by name.
  • Item menu: hover an item and click its menu (“Drag to move • Click for options”): Add Folder, Add Request, Rename, Duplicate (requests only), Delete.
  • Search: the filter icon searches request, folder and collection names (“No match found for search”).
  • Collection or folder selected: the middle shows “Collection selected” or “Folder selected”, the number of items (Content: n items), and a hint to set its authorization; see Inherited authorization.
API tree with the More menu open (Add Collection, Add Folder, Import Postman, Import Swagger / OpenAPI) and an item menu with Add Folder, Add Request, Rename, Duplicate, Delete
The More menu and an item menu.

Duplicate#

Duplicate on a request creates “name Copy” next to it with the same method, URL, headers, parameters, body and authorization. Collections and folders cannot be duplicated.

Move#

Drag a request or folder onto a collection or folder to move it inside. Drop it on a request to move it next to that request. Collections and the top folder cannot be moved; a folder cannot be dropped into its own sub folder. A failed move shows “Error during update.”

Delete#

  • Item menu › Delete: “Delete "name"?” and “This action cannot be undone.”
  • Deleting a folder or collection deletes everything inside it. If it is not empty, only an Admin can delete it; others see “Folder name could not be deleted.” or “Collection name could not be deleted.”
  • API steps that were made from a deleted request keep working: each step has its own copy. See Each step keeps its own copy.

Import a Postman collection#

  1. Export from Postman

    In Postman, export the collection as a JSON file. The file must contain the collection’s info and item parts.

  2. Open the import

    More › Import Postman. The dialog Postman Collection Import opens: “Select your Postman collection JSON file”.

  3. Pick the file and import

    Click Select File (only .json), then Import.

    “n/total requests imported successfully!” A new collection with the Postman collection’s name appears.

From PostmanBecomes
CollectionA new collection (“Imported Collection” when it has no name)
FolderA folder
RequestA request with method, URL, query parameters and headers
Body: raw, form-data, x-www-form-urlencodedThe body or form-data rows
Auth: Basic, BearerBasic Auth, Bearer Token; anything else None
Variables such as {{baseUrl}}Kept as text

Postman variables are not imported. A run reads a name without prefix from Data Source only when the reference is the whole value, so {{baseUrl}}/users is not filled (resolution order). Create a key baseUrl in Variables and replace {{baseUrl}} with {{ds:baseUrl}}. Send on this page does not fill {{baseUrl}}; see What Send sends.

Import a Swagger / OpenAPI spec#

  1. Open the import

    More › Import Swagger / OpenAPI. The dialog Import from Swagger / OpenAPI has two tabs.

  2. Give the spec

    • URL: the Swagger JSON URL, for example https://api.example.com/v3/api-docs. “Use the JSON endpoint, not the Swagger UI page”. The spec is downloaded by the SmartestQA server, so CORS is usually not a problem.
    • File Upload: a JSON or YAML file (.json, .yaml, .yml), processed on the server.
  3. Import

    “Imported n/total endpoints successfully!” A collection with the API’s title appears, with one folder per tag.

From the specBecomes
API titleThe collection name
First tag of an operationThe folder it goes into (none: the collection itself)
Summary, else operationId, else “METHOD path”The request name
Server URL + pathThe URL
Path parametersTheir default value in the URL, or the placeholder {id} when there is none
Query and header parametersParams and Header rows with their default values
Request body schema or exampleAn example JSON body and Content-Type: application/json

Security schemes are not imported: set the authorization on the collection afterwards. Replace placeholders such as {id} with a value or a reference like {{tc:orderId}} before you send.

Paste a curl command#

Paste a curl command into Request URL (placeholder “Enter URL or paste text”). SmartestQA recognizes it and fills the request: “Curl imported.”

Example · copied from the browser’s developer tools
curl -X POST 'https://test.shop.example.com/api/orders?source=web' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer eyJhbGciOi…' \
  --data-raw '{"productId": 42, "quantity": 1}'
curlBecomes
-X / --requestThe method. Without it: POST when there is data, else GET (-G forces GET).
The URLThe URL, query string kept; the query is also listed under Params
-HHeader rows
-d, --data, --data-raw, --data-binary, --data-urlencodeThe raw body (several are joined with &)
-F / --formform-data rows
-u user:pass or Authorization: Basic …Basic Auth
Authorization: Bearer …Bearer Token
-s, -L, -k, -i, -v, --compressed and similarIgnored

Replace pasted tokens

A curl copied from the browser carries a real token. After pasting, replace it with {{ds:apiToken}} from an encrypted key. A Basic login becomes Basic Auth, which a test run does not apply; see Authorization in runs.

In Automate you can also create a request and its step in one go with Create from curl; see From a curl command.

If something goes wrong#

Didn’t find your answer?Write to support with your project name and what you see on screen.

info@smartestqa.ai