Shifter verwenden mit Postman
Postman bietet erstklassige Proxy-Unterstützung — richten Sie Shifter einmalig auf globaler Ebene ein, und jede Collection läuft über Residential-IPs. Oder begrenzen Sie es pro Umgebung für die Trennung von Produktion und Staging.
Schnellstart
Installieren
// Postman desktop > Settings > Proxy. No install required. Grundlegende Nutzung
// Postman desktop > Settings > Proxy:
//
// ☑ Use custom proxy configuration
// Proxy Type: HTTP and HTTPS
// Proxy Server: p.shifter.io
// Proxy Port: 443
// ☑ This proxy requires authentication
// Proxy Auth Username: customer-USERNAME-country-us-sid-123ABC
// Proxy Auth Password: PASSWORD
//
// Every request you send (and every collection run) now routes
// through Shifter's residential pool. Funktionen
Beispiele
Pre-Request-Skript - Dynamische Sticky Session pro Ausführung
Generieren Sie zu Beginn jeder Collection-Ausführung eine neue sid und fügen Sie sie in den Proxy-Benutzernamen ein. Jede Ausführung erhält eine neue Residential-IP; Anfragen innerhalb einer Ausführung teilen sich diese IP.
// Collection-level Pre-request Script
//
// Runs once at the start of each collection / Newman run.
const sid = pm.variables.replaceIn("{{$randomAlphaNumeric}}").repeat(2).slice(0, 8);
pm.environment.set("shifter_sid", sid);
// Construct the Shifter username with country + sid + ttl
const country = pm.environment.get("country") || "us";
const user = pm.environment.get("shifter_user");
const pass = pm.environment.get("shifter_pass");
const proxyUser = `${user}-country-${country}-sid-${sid}-ttl-300`;
pm.environment.set("proxy_auth_basic",
"Basic " + Buffer.from(`${proxyUser}:${pass}`).toString("base64"));
console.log("Shifter session:", sid, "country:", country);
// Every request in this run can now reference {{proxy_auth_basic}}
// in its Proxy-Authorization header (when using Postman's "Send via
// proxy" override on individual requests). Newman CLI - Skriptgesteuerte Collection-Ausführungen
Newman ist Postmans CLI. Fügen Sie Shifter als Umgebungsvariable ein, damit CI- oder cron-gesteuerte Testläufe Residential-IPs verwenden, ohne die Collection zu ändern.
# Set Shifter as the system proxy for the Newman process
# (Newman picks up HTTP_PROXY / HTTPS_PROXY env vars automatically)
export HTTP_PROXY="customer-USERNAME-country-us-sid-ci-123ABC:PASSWORD@p.shifter.io:443"
export HTTPS_PROXY="$HTTP_PROXY"
export NO_PROXY="localhost,127.0.0.1"
newman run my-collection.postman_collection.json \
--environment production.postman_environment.json \
--reporters cli,json \
--reporter-json-export results.json
# Or scope per-run with a one-liner:
HTTP_PROXY="http://USER:PASS@p.shifter.io:443" \
HTTPS_PROXY="http://USER:PASS@p.shifter.io:443" \
newman run my-collection.postman_collection.json
# In a GitHub Actions step:
- name: Run Postman tests via Shifter
env:
HTTP_PROXY: http://${{ secrets.SHIFTER_USER }}:${{ secrets.SHIFTER_PASS }}@p.shifter.io:443
HTTPS_PROXY: http://${{ secrets.SHIFTER_USER }}:${{ secrets.SHIFTER_PASS }}@p.shifter.io:443
run: newman run collection.json --environment env.json Umgebungsspezifischer Proxy (Produktion / Staging)
Verschiedene Länder pro Umgebung, alles in einer Collection. Wechseln Sie die Umgebung und Postman verwendet den passenden Shifter Residential-Pool - keine weiteren Konfigurationsänderungen.
// Environment: "Production-US"
{
"values": [
{ "key": "shifter_user", "value": "customer-USERNAME", "type": "secret" },
{ "key": "shifter_pass", "value": "PASSWORD", "type": "secret" },
{ "key": "country", "value": "us" },
{ "key": "base_url", "value": "https://example.com" }
]
}
// Environment: "Production-UK"
{
"values": [
{ "key": "shifter_user", "value": "customer-USERNAME", "type": "secret" },
{ "key": "shifter_pass", "value": "PASSWORD", "type": "secret" },
{ "key": "country", "value": "uk" },
{ "key": "base_url", "value": "https://example.co.uk" }
]
}
// Collection-level Pre-request Script (same script in both environments):
const proxy = {
host: "p.shifter.io",
port: 443,
username: `${pm.environment.get("shifter_user")}-country-${pm.environment.get("country")}-sid-${pm.collectionVariables.get("run_id")}`,
password: pm.environment.get("shifter_pass"),
};
pm.environment.set("proxy_url", `http://${proxy.username}:${proxy.password}@${proxy.host}:${proxy.port}`);
console.log(`Routing through Shifter ${pm.environment.get("country")}`); Postman Cloud Agent (ohne lokale Installation)
Postman Cloud Agent führt Collections über Postmans Infrastruktur aus - er berücksichtigt keine Desktop-Proxy-Einstellungen. Workaround: Leiten Sie jede ausgehende Anfrage über die Shifter Web Scraping API mithilfe eines Pre-Request-Skripts und pm.sendRequest weiter.
// Cloud Agent doesn't apply your desktop proxy settings,
// so wrap every outbound request in a call to the Shifter
// Web Scraping API from a Pre-request Script.
const targetUrl = pm.request.url.toString();
const country = pm.environment.get("country") || "us";
const apiKey = pm.environment.get("shifter_api_key");
const params = new URLSearchParams({
api_key: apiKey,
url: targetUrl,
country: country,
render_js: "1", // headless browser rendering
});
pm.sendRequest({
url: `https://scrape.shifter.io/v1?${params.toString()}`,
method: "GET",
}, function (err, res) {
if (err) { console.error(err); return; }
pm.environment.set("forwarded_body", res.text());
pm.environment.set("forwarded_status", res.code);
});
// Tests assert against {{forwarded_body}} instead of the raw
// response — same shape as a real proxy hop, served from
// Shifter's residential pool. Häufig gefragt FAQ-Fragen
Häufige Fragen zur Verwendung von Shifter mit Postman.
Einstellungen > Proxy > 'Benutzerdefinierte Proxy-Konfiguration verwenden'. Geben Sie `p.shifter.io` als Host und `443` als Port ein, aktivieren Sie 'Authentifizierung erforderlich' und geben Sie Ihren Shifter-Benutzernamen (mit Länder- und sid-Selektoren) sowie Ihr Passwort an. Ab diesem Moment werden alle Anfragen über Shifter geleitet.
Shifter verwenden mit Postman
APIs testen, scrapen und überwachen mit Shifters 205M+ Residential- und ISP-Proxys. Native Proxy-Unterstützung in Postman Desktop, Newman CI-Integration und länderspezifisches Umschalten pro Umgebung.