Skip to main content
Version: 1.0.6

API Collections

Collections are the foundation of SmartAPI, allowing you to organize, share, and execute groups of API requests.

Coming Soon

This feature is currently in development.

Understanding Collections​

What is a Collection?​

A collection is a group of related API requests organized in a logical structure:

Collection: E-Commerce API
├── 📁 Authentication
│ ├── POST /auth/login
│ ├── POST /auth/register
│ ├── POST /auth/refresh
│ └── POST /auth/logout
├── 📁 Products
│ ├── GET /products
│ ├── GET /products/{id}
│ ├── POST /products
│ ├── PUT /products/{id}
│ └── DELETE /products/{id}
└── 📁 Orders
├── GET /orders
├── POST /orders
└── GET /orders/{id}

Creating Collections​

Manual Creation​

  1. Click New Collection
  2. Enter collection name and description
  3. Add folders for organization
  4. Create requests within folders

Import Options​

SourceFormat
OpenAPI/SwaggerJSON, YAML
PostmanCollection v2.1
InsomniaExport format
HAR FilesBrowser recordings
cURLCommand line imports

Collection Structure​

Folders​

Organize requests into logical groups:

  • By resource (Users, Products, Orders)
  • By functionality (Auth, CRUD, Search)
  • By test type (Smoke, Regression, Performance)

Requests​

Each request contains:

ComponentDescription
MethodHTTP method (GET, POST, etc.)
URLEndpoint path with variables
HeadersRequest headers
BodyRequest payload
AuthAuthentication settings
TestsAssertions and validations
Pre-requestSetup scripts

Variables​

Use variables for dynamic values:

// Collection variables
{{baseUrl}}/api/v1/users/{{userId}}

// Environment variables
Authorization: Bearer {{accessToken}}

Request Builder​

HTTP Methods​

MethodUse Case
GETRetrieve resources
POSTCreate new resources
PUTReplace resources
PATCHPartial updates
DELETERemove resources
HEADHeaders only
OPTIONSCORS preflight

Headers​

Common header configurations:

HeaderValue
Content-Typeapplication/json
AuthorizationBearer {{token}}
Acceptapplication/json
X-API-Key{{apiKey}}

Request Body​

Supported formats:

  • JSON - Structured data
  • Form Data - File uploads
  • URL Encoded - Form submissions
  • Raw - Plain text, XML
  • Binary - File content

Authentication​

TypeConfiguration
Bearer TokenJWT, OAuth tokens
Basic AuthUsername/password
API KeyHeader or query param
OAuth 2.0Full OAuth flow
AWS SignatureAWS services

Test Scripts​

Pre-request Scripts​

Execute before sending request:

// Generate timestamp
pm.collectionVariables.set('timestamp', Date.now());

// Create signature
const signature = CryptoJS.HmacSHA256(data, secret);
pm.request.headers.add('X-Signature', signature);

Test Scripts​

Validate responses:

// Status code check
pm.test('Status is 200', () => {
pm.response.to.have.status(200);
});

// JSON structure
pm.test('Response has user data', () => {
const json = pm.response.json();
pm.expect(json).to.have.property('id');
pm.expect(json).to.have.property('email');
});

// Response time
pm.test('Response time < 500ms', () => {
pm.expect(pm.response.responseTime).to.be.below(500);
});

Collection Runner​

Running Collections​

Execute entire collections or folders:

OptionDescription
IterationsRun multiple times
DelayPause between requests
Data FileCSV/JSON for data-driven tests
EnvironmentSelect environment

Execution Order​

Control request sequence:

  1. Folder order (top to bottom)
  2. Request order within folders
  3. Conditional flow with scripts

Data-Driven Testing​

Use external data files:

email,password,expectedStatus
[email protected],pass123,200
[email protected],wrong,401
,pass123,400

Sharing & Collaboration​

Team Sharing​

  • Share collections with team members
  • Role-based access (View, Edit, Admin)
  • Version history and rollback

Export Options​

FormatUse Case
JSONBackup, sharing
OpenAPIDocumentation
HTMLStatic documentation
MarkdownREADME files

Best Practices​

Organization​

  • Use consistent naming conventions
  • Group by domain/resource
  • Include descriptions

Variables​

  • Use environment variables for URLs
  • Store secrets securely
  • Document variable usage

Testing​

  • Add assertions to every request
  • Test both success and error cases
  • Validate response schema

Maintenance​

  • Regular cleanup of unused requests
  • Update documentation
  • Review and refactor periodically