hosting

POST /v1/sites/{siteId}/redirects

Add a redirect to a site.

تمام hosting اینڈ پوائنٹس

توثيقِ شناخت

ایک بیرر ٹوکن کے طور پر ایک API کی بھیجیں۔ کی کے پاس sites.view اجازت ہونی چاہیے؛ اس کے بغیر کی کو 404 کے بجائے 403 کے ساتھ مسترد کر دیا جاتا ہے۔

یہ اینڈ پوائنٹ کوئی آرگنائزیشن آئی ڈی نہیں لیتا۔ آپ کی کلید پہلے ہی اس آرگنائزیشن کی شناخت کرتی ہے جس سے یہ تعلق رکھتی ہے، اور اس کا جواب اسی کے مطابق محدود ہوتا ہے۔

آزمائیں

کوئی بھی چیز جو زاویہ دار قوسین میں ہو اسے اپنی اقدار سے بدلیں، اور کلیدی پلیس ہولڈر کو اپنے ڈیش بورڈ کی کسی کلید سے بدلیں۔

curl -X POST https://api.zinndigital.com/v1/sites/{siteId}/redirects \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "domain": <string>, "path": <string>, "destination": <string> }'

لاگ ان ہیں؟ آپ کے ڈیش بورڈ میں موجود API کنسول آپ کی حقیقی تنظیم کی آئی ڈی اور آپ کی اپنی کلید خود بخود پُر کر دیتا ہے، اور لائیو API پر درخواست چلاتا ہے تاکہ آپ اصل ردعمل دیکھ سکیں۔ اس اینڈ پوائنٹ کو API کنسول میں کھولیں

تفصیلات

Adds one rule. ⛔ **The vendor endpoint behind this is a whole-set write**, so the engine reads the existing rules, appends, and sends the set back — last writer wins. Two people adding a redirect at the same moment is the one case where one of the two additions is lost, and there is no vendor primitive that would prevent it. `destination` is checked before anything is written to the customer's `.htaccess`: a protocol-relative `//evil.example/` passes a naive "starts with a slash" test and redirects the site's visitors to somebody else's server, so it is refused `422` here. `type` is a closed set (`301`, `302`) checked in this layer **and** in the driver, because the platform types it as a free string and an unreviewed token would be written straight into the file. `404` for a site with no managed hosting package. Requires `sites.view` and `sites.panel_access`.

پیرامیٹرز

نامقسملازمییہ کیا ہے
siteId (path)UuidہاںSite ID (UUIDv7).

درخواست کا باڈی

نامقسملازمییہ کیا ہے
domainstringہاںThe domain or alias on the package the rule applies to.
pathstringہاںThe path being redirected. ⛔ Named `path` and never `source` — `source` is a reserved attribute on every serializer field one layer down, and a field of that name silently reads…
destinationstringہاںWhere the visitor is sent. A protocol-relative value is refused: it hands the customer's visitors to another server while looking like a local path.
typestring<301, 302>نہیںThe redirect status. `301` is permanent and is cached by browsers and search engines; `302` is temporary. Nothing else is accepted.

جواب

نامقسملازمییہ کیا ہے
idstringہاں⛔ **Ours, not the vendor's** — this platform mints no identifier for a redirect, so this encodes the domain/type/path triple that addresses one. Opaque, stable across reads, and…
domainstringہاںThe domain or alias the rule applies to.
pathstringہاںThe path being redirected. ⛔ Named `path` and never `source`, which is a reserved attribute one layer down and would silently read the wrong value.
destinationstringہاںWhere the visitor is sent.
typestring<301, 302>ہاںThe redirect status — permanent or temporary.

وہ خرابیان جو یہ اینڈ پوائنٹ واپس کر سکتا ہے

401 · 403 · 404 · 409 · 422 · 429 · 503