Skip to content
Documentation
pozyskajpacjentaDocs

API referenceContent

List the site's redirects

GET/api/v1/redirects

Since
1.28.0
Auth
Bearer key
operationId
listRedirects

The old addresses the clinic's site serves now and where each leads: the snapshot the site itself reads. A sub-page whose address changes in the panel leaves one behind, so a frontend of its own needs this list to answer the old address instead of a 404. An empty list when the clinic has no redirects. Responses are private to the key: Cache-Control: private, max-age=60, so cache them on your side for up to a minute.

Request

Send the clinic's key in Authorization: Bearer (see API keys).

No parameters and no body.

curl "https://app.pozyskajpacjenta.pl/api/v1/redirects" \
  -H "Authorization: Bearer $PP_API_KEY"
import { PozyskajPacjentaClient } from "@pozyskajpacjenta/sdk";

const client = new PozyskajPacjentaClient({
  apiKey: process.env.PP_API_KEY ?? "",
  baseUrl: "https://app.pozyskajpacjenta.pl",
});

const { redirects } = await client.listRedirects();
<?php
$response = wp_remote_get(
    'https://app.pozyskajpacjenta.pl/api/v1/redirects',
    array(
        'headers' => array( 'Authorization' => 'Bearer ' . getenv( 'PP_API_KEY' ) ),
        'timeout' => 10,
    )
);
if ( is_wp_error( $response ) ) {
    error_log( $response->get_error_message() );
    return;
}
$status = wp_remote_retrieve_response_code( $response );
$data   = json_decode( wp_remote_retrieve_body( $response ), true );

Response

200The site's redirects.

  • redirectsRedirectRule[]required

    The old addresses and where they lead.

    Fields of each item (3)
    • fromstringrequired

      The old path, with its query when the rule has one.

    • tostringrequired

      The path on this site. Chains are already flattened: this is the final address.

    • statusintegerrequired

      301 for a permanent move, 302 for a temporary one.

      One of 301302

A sub-page moved to a new address, and an old address of the clinic's site

{
  "redirects": [
    {
      "from": "/implanty",
      "to": "/implanty-zebow",
      "status": 301
    },
    {
      "from": "/uslugi/implanty",
      "to": "/implanty-zebow",
      "status": 301
    }
  ]
}

Errors

StatusWhen
401No Authorization header
401Unknown or rotated key
429Over 120 requests in this minute

Branch on the status and code, never on the Polish error text. All statuses in Errors.

401 · No Authorization header
{
  "error": "missing Authorization: Bearer <klucz z panelu Ustawienia>"
}
401 · Unknown or rotated key
{
  "error": "invalid key"
}
429 · Over 120 requests in this minute
{
  "error": "przekroczono limit 120 zapytań/min"
}

Rate limit

  • 120 requests per minute per key, shared by every endpoint.
  • Every response to a valid key carries RateLimit-Remaining and RateLimit-Reset; see Rate limits.

SDK method

client.listRedirects(): Promise<{ redirects: RedirectRule[] }>

The TypeScript tab above uses it. Install and errors: TypeScript SDK.