########################################################################################################################################################################################################################################################## Copiar todos los comandos
########################################################################################################################################################################################################################################################## Generar PDF seleccionado/button
■/div titulada
Atajos y flujos de trabajo completos de Postman para el desarrollo y pruebas de API.
Navegación básica
Shortcut
Description
Ctrl+N
New Request
Ctrl+Shift+N
New Collection
Ctrl+O
Open
Ctrl+S
Save
Ctrl+Shift+S
Save As
Ctrl+Enter
Send Request
Ctrl+R
Reload
Ctrl+W
Close Tab
Ctrl+Shift+W
Close All Tabs
Ctrl+T
New Tab
Ctrl+Shift+T
Reopen Closed Tab
Solicitud de gestión
Shortcut
Description
Ctrl+L
Focus URL Bar
Ctrl+M
Change HTTP Method
Ctrl+Shift+P
Open Command Palette
Ctrl+K
Search Collections
Ctrl+H
Show/Hide Sidebar
Ctrl+Alt+C
Open Console
Ctrl+Alt+E
Open Environment Quick Look
Edición de texto
Shortcut
Description
Ctrl+A
Select All
Ctrl+C
Copy
Ctrl+V
Paste
Ctrl+X
Cut
Ctrl+Z
Undo
Ctrl+Y
Redo
Ctrl+F
Find
Ctrl+G
Find Next
Ctrl+Shift+G
Find Previous
F3
Find Next
Shift+F3
Find Previous
Medio ambiente y variables
Shortcut
Description
Ctrl+Alt+E
Environment Quick Look
Ctrl+Shift+E
Manage Environments
\\{\\{variable\\}\\}
Variable Syntax
pm.environment.get("var")
Get Environment Variable
pm.environment.set("var", "value")
Set Environment Variable
pm.globals.get("var")
Get Global Variable
pm.globals.set("var", "value")
Set Global Variable
HTTP Métodos y Códigos de Estado
HTTP común Métodos
Method
Purpose
Example
GET
Retrieve data
Get user profile
POST
Create new resource
Create new user
PUT
Update entire resource
Update user profile
PATCH
Partial update
Update user email
DELETE
Remove resource
Delete user account
HEAD
Get headers only
Check if resource exists
OPTIONS
Get allowed methods
CORS preflight
HTTP Status Codes
Code Range
Type
Common Codes
2xx
Success
200 OK, 201 Created, 204 No Content
3xx
Redirection
301 Moved, 302 Found, 304 Not Modified
4xx
Client Error
400 Bad Request, 401 Unauthorized, 404 Not Found
5xx
Server Error
500 Internal Error, 502 Bad Gateway, 503 Unavailable
// Status code tests
pm.test("Status code is 200", function () \\\\{
pm.response.to.have.status(200);
\\\\});
pm.test("Status code name has string", function () \\\\{
pm.response.to.have.status("OK");
\\\\});
// Response time test
pm.test("Response time is less than 200ms", function () \\\\{
pm.expect(pm.response.responseTime).to.be.below(200);
\\\\});
// Header tests
pm.test("Content-Type is present", function () \\\\{
pm.response.to.have.header("Content-Type");
\\\\});
pm.test("Content-Type is application/json", function () \\\\{
pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
\\\\});
JSON Pruebas de respuesta
// Parse JSON response
const responseJson = pm.response.json();
// Test JSON structure
pm.test("Response has required fields", function () \\\\{
pm.expect(responseJson).to.have.property("id");
pm.expect(responseJson).to.have.property("name");
pm.expect(responseJson).to.have.property("email");
\\\\});
// Test specific values
pm.test("User ID is correct", function () \\\\{
pm.expect(responseJson.id).to.eql(123);
\\\\});
pm.test("Email format is valid", function () \\\\{
pm.expect(responseJson.email).to.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/);
\\\\});
// Test array responses
pm.test("Response is an array", function () \\\\{
pm.expect(responseJson).to.be.an('array');
\\\\});
pm.test("Array has correct length", function () \\\\{
pm.expect(responseJson).to.have.lengthOf(5);
\\\\});
Extracción variable
// Extract data from response
const responseJson = pm.response.json();
// Set environment variables
pm.environment.set("userId", responseJson.id);
pm.environment.set("userToken", responseJson.token);
// Extract from headers
const location = pm.response.headers.get("Location");
pm.environment.set("resourceUrl", location);
// Extract using regex
const responseText = pm.response.text();
const match = responseText.match(/token:\s*"([^"]+)"/);
if (match) \\\\{
pm.environment.set("extractedToken", match[1]);
\\\\}
Colección Runner
Running Collections
// Collection variables
pm.collectionVariables.set("baseUrl", "https://api.example.com");
pm.collectionVariables.get("baseUrl");
// Data-driven testing
// Use CSV or JSON files for test data
// Access data using pm.iterationData.get("fieldName")
// Workflow control
postman.setNextRequest("Request Name");
postman.setNextRequest(null); // Stop execution