NAV -image
bash javascript

Introduction

Portalz API

Authenticating requests

This API is authenticated by sending an Authorization header with the value "Bearer {your-token}".

Portals

APIs for managing portals

GET all portals

This endpoint gets all avaliable portals. No pagination needed.

Example request:

curl -X GET \
    -G "http://portalz.b01.de/api/v1/portals" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/api/v1/portals"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

[
    {
        "id": 2,
        "title": "immobilienscout24",
        "description": "",
        "logo": "https:\/\/www.immobilienscout24.de\/etc\/designs\/is24\/img\/immoscout24.svg",
        "url": "https:\/\/www.immobilienscout24.de\/",
        "import": 1,
        "export": 0,
        "interface": [
            "is24"
        ],
        "server": "",
        "locale": [
            "DE"
        ],
        "cnt": 1500000,
        "created_at": null,
        "updated_at": null
    },
    {
        "id": 3,
        "title": "Immowelt",
        "description": "",
        "logo": "https:\/\/cdnglobal.immowelt.org\/global-assets\/4.0.1\/legacy\/0\/images\/logo_immowelt.svg",
        "url": "https:\/\/www.immowelt.de\/",
        "import": 1,
        "export": 0,
        "interface": [
            "openimmo"
        ],
        "server": "",
        "locale": [
            "DE"
        ],
        "cnt": 1200000,
        "created_at": null,
        "updated_at": null
    }
]

Request

GET api/v1/portals

GET locale portals

This endpoint gets specified locale portals.

Example request:

curl -X GET \
    -G "http://portalz.b01.de/api/v1/portals/1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/api/v1/portals/1"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

[
    {
        "id": 7,
        "title": "Kiero",
        "description": "",
        "logo": "https:\/\/frontend-assets3.kyero.com\/assets\/logo-eafbec51f2b00e87cf3aaa6598de909e67b5b4598297eb5334be938f391d2361.svg",
        "url": "https:\/\/www.kyero.com\/",
        "import": 1,
        "export": 0,
        "interface": [
            "kyero"
        ],
        "server": "ftp.kyero.co.uk",
        "locale": [
            "ES",
            "FR",
            "IT"
        ],
        "cnt": 200000,
        "created_at": null,
        "updated_at": null
    },
    {
        "id": 27,
        "title": "green-acres.fr",
        "description": "",
        "logo": null,
        "url": "https:\/\/www.green-acres.com\/de",
        "import": 0,
        "export": 0,
        "interface": [
            "openimmo"
        ],
        "server": "",
        "locale": [
            "FR"
        ],
        "cnt": 768000,
        "created_at": null,
        "updated_at": null
    }
]

Request

GET api/v1/portals/{locale:[A-Z]{2}}

URL Parameters

locale 
ISO 3166-1-alpha-2 code (e.g. FR).

GET single portal

Example request:

curl -X GET \
    -G "http://portalz.b01.de/api/v1/portals/1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/api/v1/portals/1"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "id": 1,
    "title": "immonet",
    "description": "",
    "logo": "https:\/\/cdnglobal.immonet.de\/global-assets\/4.0.1\/legacy\/195\/images\/logo_with_claim.svg",
    "url": "https:\/\/www.immonet.de",
    "import": 1,
    "export": 0,
    "interface": [
        "openimmo"
    ],
    "server": "",
    "locale": [
        "DE"
    ],
    "cnt": 1500000,
    "published": 1,
    "created_at": null,
    "updated_at": null
}

Request

GET api/v1/portals/{id:[0-9]+}

URL Parameters

id 
The id of the portal.

POST portal

requires authentication

When posting a portal you automatically become owner

Example request:

curl -X POST \
    "http://portalz.b01.de/api/v1/portals" \
    -H "Authorization: Bearer c36Vbg86f5ad1eZkPDv4hEa" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"title":"unde","import":0,"export":1,"interface":"openimmo,kyero","url":"https:\/\/www.prime-real.de","description":"ex","server":"ftp.prime-real.de","locale":"DE,EN","cnt":13}'
const url = new URL(
    "http://portalz.b01.de/api/v1/portals"
);

let headers = {
    "Authorization": "Bearer c36Vbg86f5ad1eZkPDv4hEa",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "title": "unde",
    "import": 0,
    "export": 1,
    "interface": "openimmo,kyero",
    "url": "https:\/\/www.prime-real.de",
    "description": "ex",
    "server": "ftp.prime-real.de",
    "locale": "DE,EN",
    "cnt": 13
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Request

POST api/v1/portals

Body Parameters

title  string

import  integer
0 or 1

export  integer
0 or 1

interface  set

url  string

description  string optional

server  string

locale  string
comma seperated ISO 3166-1-alpha-2 code

cnt  integer optional

DELETE portal

requires authentication

Delete portal. Only possible if admin.

Example request:

curl -X DELETE \
    "http://portalz.b01.de/api/v1/portals/1" \
    -H "Authorization: Bearer 4Z5gPDh1da36Ekvb8Vcfea6" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/api/v1/portals/1"
);

let headers = {
    "Authorization": "Bearer 4Z5gPDh1da36Ekvb8Vcfea6",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Request

DELETE api/v1/portals/{id}

PUT portal

requires authentication

Update portal. Only possible if owner or admin.

Example request:

curl -X PUT \
    "http://portalz.b01.de/api/v1/portals/1" \
    -H "Authorization: Bearer Z1faVcD8g365ah4Pbd6evEk" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/api/v1/portals/1"
);

let headers = {
    "Authorization": "Bearer Z1faVcD8g365ah4Pbd6evEk",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Request

PUT api/v1/portals/{id}

Users

APIs for managing users

Register

Register a new user and get a token. User can publish a new portal.

Example request:

curl -X POST \
    "http://portalz.b01.de/auth/register" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"hans meiser","email":"hans@meiser.com","password":"123456"}'
const url = new URL(
    "http://portalz.b01.de/auth/register"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "hans meiser",
    "email": "hans@meiser.com",
    "password": "123456"
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhfd673hdiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXV0aFwvcmVnaXN0ZXIiLCJpYXQiOjE1OTc0MTU2MjYsImV4cCI6MTU5NzQxOTIyNiwibmJmIjoxNTk3NDE1NjI2LCJqdGkiOiJiY05kOHpFR1dEaTVYcEV2Iiwic3ViIjo5LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.cyFX49ksI28JnKntjdnz1LttdUmtP2H9LyEA0pY-SL0",
    "token_type": "bearer",
    "expires_in": 3600
}

Request

POST auth/register

Body Parameters

name  string

email  string

password  string

Login

Example request:

curl -X POST \
    "http://portalz.b01.de/auth/login" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"email":"hans@meiser.com","password":"123456\n\nGet a JWT via given credentials."}'
const url = new URL(
    "http://portalz.b01.de/auth/login"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "email": "hans@meiser.com",
    "password": "123456\n\nGet a JWT via given credentials."
}

fetch(url, {
    method: "POST",
    headers: headers,
    body: body
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (200):

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhfd673hdiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9sb2NhbGhvc3Q6ODAwMFwvYXV0aFwvcmVnaXN0ZXIiLCJpYXQiOjE1OTc0MTU2MjYsImV4cCI6MTU5NzQxOTIyNiwibmJmIjoxNTk3NDE1NjI2LCJqdGkiOiJiY05kOHpFR1dEaTVYcEV2Iiwic3ViIjo5LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.cyFX49ksI28JnKntjdnz1LttdUmtP2H9LyEA0pY-SL0",
    "token_type": "bearer",
    "expires_in": 3600
}

Request

POST auth/login

Body Parameters

email  required optional

password  required optional

Logout

requires authentication

Log the user out (Invalidate the token).

Example request:

curl -X POST \
    "http://portalz.b01.de/auth/logout" \
    -H "Authorization: Bearer PEbk681dahZDfv3ge54Vca6" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/auth/logout"
);

let headers = {
    "Authorization": "Bearer PEbk681dahZDfv3ge54Vca6",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Request

POST auth/logout

Refresh token

requires authentication

Get new token.

Example request:

curl -X POST \
    "http://portalz.b01.de/auth/refresh" \
    -H "Authorization: Bearer 6va8PdDaZ43gke6b5EcVf1h" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/auth/refresh"
);

let headers = {
    "Authorization": "Bearer 6va8PdDaZ43gke6b5EcVf1h",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Request

POST auth/refresh

Get User

requires authentication

Get the authenticated User.

Example request:

curl -X GET \
    -G "http://portalz.b01.de/auth/me" \
    -H "Authorization: Bearer bPgEfhaav6c6Vd8543De1Zk" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "http://portalz.b01.de/auth/me"
);

let headers = {
    "Authorization": "Bearer bPgEfhaav6c6Vd8543De1Zk",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers: headers,
})
    .then(response => response.json())
    .then(json => console.log(json));

Example response (401):


Unauthorized.

Request

GET auth/me