KPN

Disturbance Detector - KPN

KPN

Retrieve an overview of all network disturbances within the Netherlands

A complete and reliable list of network disturbances

  • Network

API reference on SwaggerHub API reference on Postman

Introduction

The Disturbance Detector API allows you to get an overview of all disturbances in the KPN network in the Netherlands.

Conceptual model

Conceptual model

API workflow

Sequence diagram

Getting started

Authentication

OAuth 2.0

For accessing and/or manipulating the resources, the client application (your application) needs to be granted permission to do so. The OAuth 2.0 standard defines a protocol that allows such third party authorization through the use of access tokens. Access tokens are central in the protocol. These tokens, in the form of strings, are delivered by an authorization server (our authentication server) and they enable the client application to securely access protected data on behalf of the resource owner (the end user).

We use Client Credentials Grant. This means the application makes the request to the authentication service by sending authorization credentials. The service responds with an access token among other useful information.

Get access token with cURL

Copy your app's credentials and replace APP_CONSUMER_KEY and APP_CONSUMER_SECRET with the copied values, then execute below curl command to receive access token.

curl -X POST  'https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials'  -H 'content-type: application/x-www-form-urlencoded'  -d 'client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET'

Note: If you are using cURL for Windows then please use the below command.

curl -X POST "https://api-prd.kpn.com/oauth/client_credential/accesstoken?grant_type=client_credentials" -H "content-type: application/x-www-form-urlencoded" -d "client_id=APP_CONSUMER_KEY&client_secret=APP_CONSUMER_SECRET"

The authorization service returns a JSON message that contains the access token field.

{
    "refresh_token_expires_in": "0",
    "api_product_list": "[xxxxxxx]",
    "api_product_list_json": [
        " xxxxxxx"
    ],
    "organization_name": "kpn",
    "developer_email": "demo123@kpn.com",
    "token_type": "Bearer",
    "issued_at": "1521039195424",
    "client_id": "APP_CONSUMER_KEY",
    "access_token": "haf2SDl07E9N7RluNQ4kJ1TkGgso",
    "application_name": "6e38ed2d-48b1-4362-97d6-04254065d79c",
    "scope": "",
    "expires_in": "3599",
    "refresh_count": "0",
    "status": "approved"
}

Get access token with SwaggerHub

  1. Upon loading completed within SwaggerHub, look top right for the Authorize button and click it.
  2. In the form, fill in client_id and client_secret fields, using your app's credentials.
  3. Click Authorize.
  4. Now you are authorized to issue the requests provided.

Get access token with Postman

  1. Select Get Access Token from the collection.
  2. Make sure the right Environment corresponding to the API is selected.
  3. Edit the environment variables client_id and client_secret, using your app's credentials.
  4. Check the response code and message.
  5. Press the Sendbutton to get the access token.
  6. Now you are authorized to issue the other requests in the collection.

How to...

Detect network disturbances

SwaggerHub:

  1. Check disturbance GET /failures.
  2. Click Try it out.
  3. Supply state.
  4. Click Execute.
  5. Check the response code and message.

Postman: 1. Request GET (DetectDisturbance). 2. Supply state. 3. Click Send. 4. Check the response code and message.

the result of the call will look like the following:

[
    {
        "id": 1212,
        "affected_elements_count": 3,
        "affected_customers_count": 549,
        "communicated_customers_sms_count": 348,
        "communicated_customers_email_count": 200,
        "type": "geographical-broadband",
        "cause": "disturbance",
        "source": "gui",
        "service": null,
        "state": "open",
        "start_date": "2017-06-29T12:29:06Z",
        "end_date": "2017-06-29T09:27:05Z",
        "region": "Woerden",
        "description": null,
        "long_description": "<p>Auto-generated long_description field for geographical-broadband. This is an geographical failure. testing123</p>",
        "serviceguard_ticket_id": "gtgyyg",
        "created_at": "2017-06-29T12:29:06Z",
        "communication_type": null,
        "user": null
    },
    ...
    ...
    ...
]

Return codes

Code   Description
200   Success
201   Created
202   Accepted
302   Found. Link in location header
400   Bad request
401   Unauthorized
403   Forbidden
404   Not found
405   Method not allowed
412   Precondition failed
429   Too many requests
500   Internal server error
502   Bad gateway
503   Service unavailable

API versions

Version   Description
1.0   Initial version