NAV
shell

Introduction

Welcome to the Inviplay API Reference! You can use our API to access Inviplay API endpoints, which can get upcoming events in the Inviplay network, add new users and new events.

Authentication

Get token

First, get an access token:

curl POST 'https://authentication.inviplay.nl/connect/token' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=CLIENT_ID' \
--data-urlencode 'client_secret=CLIENT_SECRET'

This returns the following JSON:

{
  "access_token": "ACCESS_TOKEN",
  "expires_in": 3600,
  "token_type": "Bearer",
  "scope": "CreateEvent RegisterUser"
}

To authorize every api request, use the above ACCESS_TOKEN:

curl 'api_endpoint_here' \
  -H 'Authorization: Bearer ACCESS_TOKEN'

Make sure to replace ACCESS_TOKEN with the token that you will get from the /token endpoint.

Inviplay uses an access token to allow access to the API. To request a token you need a client_id and a client_secret and use that in the following request:

HTTP Request

POST https://authentication.inviplay.nl/connect/token

Body

Key Value
grant_type client_credentials
client_id CLIENT_ID
client_secret CLIENT_SECRET

User

Add new user

curl -X POST 'http://api.inviplay.nl/user' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "username": "theo_janssen_79",
  "email": "theo@inviplay.nl",
  "firstName": "Theo",
  "lastName": "Janssen",
  "newsletterActivities": true,
  "postalCode": "6821AA",
  "rangeChoice": 5,
  "activities": [1, 4, 11],
  "newsletterGeneral": false,
}'

This returns the userId of the created user:

{
  "userId": "5243a717-7084-4c82-9ea4-7f8f08d63327"
}

This endpoint creates a new user in the Inviplay database

HTTP Request

POST http://api.inviplay.nl/user

Request body

Parameter Required Type Default Description
username required String - Needs to be unique
email required String - Email address can be used multiple times
firstName required String -
lastName required String -
newsletterActivities optional Boolean false If a user wants to receive invites for events in his neighbourhood this needs to be true.
postalCode optional String null If a user wants to receive invites for events this needs to be provided
rangeChoice optional Number null If a user wants to receive invites for events this is the range in kilometers from his own postalCode in which he will receive invites.
activities optional Array null If a user wants to receive invites for events these are the activityId's he wants to receive invites for
newsletterGeneral optional Boolean false If a user wants to receive occasional updates about about Inviplay this needs to be true.

Get user

curl 'http://api.inviplay.nl/user/5243a717-7084-4c82-9ea4-7f8f08d63327' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
}'

This returns the details of the user

{
  "username": "theo_janssen_79",
  "email": "theo@inviplay.nl",
  "firstName": "Theo",
  "lastName": "Janssen",
  "newsletterActivities": true,
  "postalCode": "6821AA",
  "rangeChoice": 5,
  "activities": [1, 4, 11],
  "newsletterGeneral": false,
}

HTTP Request

GET http://api.inviplay.nl/user/{{userID}}

Update user

curl -X PUT 'http://api.inviplay.nl/user/5243a717-7084-4c82-9ea4-7f8f08d63327' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
  -H 'Content-Type: application/json' \
  --data-raw '{
    "email": "lennert@inviplay.nl",
    "firstName": "Lennert",
    "lastName": "Molema",
    "postalCode": "3555BA",
    "rangeChoice": 25,
    "activities": [ 10, 11 ],
    "newsletterActivities": false,
    "newsletterGeneral": false
}'

This returns the updated user

{
  "email": "lennert@inviplay.nl",
  "firstName": "Lennert",
  "lastName": "Molema",
  "postalCode": "3555BA",
  "rangeChoice": 25,
  "activities": [ 10, 11 ],
  "newsletterActivities": false,
  "newsletterGeneral": false
}

This request returns the updated user.

HTTP Request

PUT http://api.inviplay.nl/user/{{userID}}

The following fields are the ones that can be changed.

Request body

Parameter Required Type Default Description
email required String -
firstName required String -
lastName required String -
newsletterActivities optional Boolean false
postalCode optional String null
rangeChoice optional Number null
activities optional Array null
newsletterGeneral optional Boolean

You have to PUT all of the above fields also if they are not changed, since the complete object will be replaced. If a field is not provided the default value will be stored.

Get events a user has signed up for

curl 'http://api.inviplay.nl/user/5243a717-7084-4c82-9ea4-7f8f08d63327/events/joined' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
}'

This returns a list of dates of events the user has signed up for

[
  {
    "eventId": 123,
    "name": "Ga je mee klimmen?",
    "description": "Doe een keer vrijblijvend mee in de grootste klimhal van Arnhem",
    "cost": "5.00",
    "dateId": 456,
    "startDateTime": "2021-07-16T08:00:00+00:00",
    "endDateTime": "2021-07-16T10:00:00+00:00",
  }
]

This request returns all the dates a user has signed up for.

HTTP Request

GET http://api.inviplay.nl/user/{{userID}}/events/joined

Get the events created by user

curl 'http://api.inviplay.nl/user/5243a717-7084-4c82-9ea4-7f8f08d63327/events/created' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
}'

This returns a list of events the user has created

[
  {
    "eventId": 123,
    "name": "Ga je mee klimmen?",
    "description": "Doe een keer vrijblijvend mee in de grootste klimhal van Arnhem",
    "cost": "5.00",
    "dates": [
      {
        "startDateTime": "2021-07-16T08:00:00+00:00",
        "endDateTime": "2021-07-16T10:00:00+00:00",
        "numberOfParticipants": 3,
        "dateId": 456
      }
    ],
    "targetGroup": [],
    "maximumParticipants": 4,
    "imageUrl": "/api/attachments/inviplay-219209.appspot.com/download/4a3f86b1-9b6f-40d9-9ec0-48e388f19a43",
    "location": {
      "locationId": 12,
      "name": "Klimhal Mountain Network Arnhem",
      "adress": "Olympus 27",
      "postalCode": "6832 EL",
      "city": "Arnhem",
      "coordinates": {
        "lng": 4.692161717541481,
        "lat": 52.67758735617635
      }
    },
    "activity": {
      "name": "Klimmen",
      "activityId": 39
    }
  }
]

This request returns all the dates a user has created.

HTTP Request

GET http://api.inviplay.nl/user/{{userID}}/events/created

Get the locations created by user

curl 'http://api.inviplay.nl/user/5243a717-7084-4c82-9ea4-7f8f08d63327/locations' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
}'

This returns a list of events the user has created

[
  {
    "adress": "Oudegracht 143",
    "city": "Utrecht",
    "coordinates": {
      "lat": 52.09129938255362,
      "lng": 5.117693057604256
    },
    "country": "Nederland",
    "description": null,
    "id": 1,
    "image": null,
    "imageUrl": null,
    "name": "Utrecht centrum",
    "postalCode": "3511 AJ"
    },
  }
]

This request returns all the locations a user has created.

HTTP Request

GET http://api.inviplay.nl/user/{{userID}}/locations

Event

An event is the main object in the Inviplay ecosystem. It holds al the characteristics of an event, but not the start date and end date. These are stored sepperately in a dates table. This way an event can have multiple dates to make it possible to create recurring dates that belong to the same event.

Get all upcoming events

curl 'https://api.inviplay.nl/event/upcoming?limit=1' \
  -H 'Authorization: Bearer ACCESS_TOKEN'

The above command returns JSON structured like this:

[
  {
    "id": 123,
    "name": "Ga je mee klimmen?",
    "description": "Doe een keer vrijblijvend mee in de grootste klimhal van Arnhem",
    "cost": 500,
    "costFeeIncluded": 550,
    "dates": [
      {
        "startDateTime": "2021-07-16T08:00:00+00:00",
        "endDateTime": "2021-07-16T10:00:00+00:00",
        "numberOfParticipants": 3,
        "id": 456
      }
    ],
    "targetGroup": [],
    "maximumParticipants": 4,
    "imageUrl": "/api/attachments/inviplay-219209.appspot.com/download/4a3f86b1-9b6f-40d9-9ec0-48e388f19a43",
    "location": {
      "id": 12,
      "name": "Klimhal Mountain Network Arnhem",
      "adress": "Olympus 27",
      "postalCode": "6832 EL",
      "city": "Arnhem",
      "coordinates": {
        "lng": 4.692161717541481,
        "lat": 52.67758735617635
      }
    },
    "activity": {
      "name": "Klimmen",
      "activityId": 39
    },
    "recurring": "None",
    "tags": ["sia"]
  }
]

This endpoint retrieves all upcoming events.

HTTP Request

GET https://api.inviplay.nl/event/upcoming

Optional parameters

Parameter Required Type
limit optional number
skip optional number

Get all upcoming events with every date as single object

curl 'https://api.inviplay.nl/event/upcoming_by_date' \
  -H 'Authorization: Bearer ACCESS_TOKEN'

The above command returns JSON structured like this:

[
  {
    "dateId": 3001,
    "numberOfParticipants": 3,
    "startDateTime": "2022-05-21T20:00:00+00:00",
    "endDateTime": "2022-05-21T21:00:00+00:00",
    "eventId": 600,
    "cost": 500,
    "costFeeIncluded": 550,
    "name": "Potje voetballen?",
    "description": "Doe je mee met een potje voetbal in de stad?",
    "maximumParticipants": 4,
    "location": {
        "id": 1,
        "name": "Kooi in de stad",
        "address": "Oudegracht 143",
        "postalCode": "3511 AJ",
        "city": "Utrecht",
        "coordinates": {
            "lng": 5.117693,
            "lat": 52.0913
        }
    },
    "activity": {
        "id": 1,
        "name": "Voetbal"
    },
    "imageUrl": "",
    "targetGroup": [2],
    "tags": ["sia"]
  }
]

This endpoint retrieves all upcoming events with every date as single object.

HTTP Request

GET https://api.inviplay.nl/event/upcoming_by_date

Optional parameters

Parameter Required Type
limit optional number
skip optional number

Get only events in specific city

Get a list of upcoming events only in a specific city.

HTTP Request

GET https://api.inviplay.nl/event/upcoming/{city}

Get only events of specific sport type

Get a list of upcoming events that has a specific sport type. You can retrieve the list of Id's with the GET /activity endpoint.

HTTP Request

GET https://api.inviplay.nl/event/{city}/{activityId}

Get only events for specific target group

Get a list of upcoming events that are for a specific target group. You can retrieve the list of Id's with the GET /targetgroup endpoint.

HTTP Request

GET https://api.inviplay.nl/event/upcoming/target_group/2

Add new event

curl -X POST 'https://api.inviplay.nl/event' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
    "userId" 123,
    "name": "Ga je mee klimmen?",
    "description": "Doe een keer vrijblijvend mee in de grootste klimhal van Arnhem",
    "activityId": 39,
    "locationId": 12,
    "start": "2021-07-16T08:00:00+00:00",
    "end": "2021-07-16T10:00:00+00:00",
    "maximumParticipants": 4,
    "cost": 500,
    "imageBase64": ""iVBORw0KGgoAAAANSUhEUgAABLAAAAE2CAYAAABx8GutAAAAGXRFWHRTb2Z0d2FyZQBBZG......."
    "tags": ["sia"]
  }'

The above request returns the created event id:

{
  "eventId": 123,
}

Add a new event to the Inviplay database. Some remarks:

HTTP Request

POST https://api.inviplay.nl/event

Request body

Parameter Required Type Default Description
userId required String - User Id of the organizer of the event
name required String - Name of the event
description required String - Description of the event
activityId required Number - Id of activity
locationId required Number - Id of location
start required Date - The start date as local date
end required Date - The end date as local date
maximumParticipants required Number null
recurring optional String None Possible values: None,SevenDays, FourteenDays, OneMonth, SixMonth,OneYear.
targetGroup optional Number[] null Array of targetGroup Id's
cost optional int null The costs are handled in cents (cost is without fee, will be included based on business rules)
imageBase64 optional String null Base64 string of image that needs to be uploaded
tags optional String[] null Array of free to choose strings

Get event details

curl 'https://api.inviplay.nl/event/123' \
  -H 'Authorization: Bearer ACCESS_TOKEN'

The above request returns the following JSON:

{
  "id": 123,
  "name": "Ga je mee klimmen?",
  "description": "Doe een keer vrijblijvend mee in de grootste klimhal van Arnhem",
  "cost": 500,
  "costFeeIncluded": 550,
  "dates": [
    {
      "startDateTime": "2021-07-16T08:00:00+00:00",
      "endDateTime": "2021-07-16T10:00:00+00:00",
      "numberOfParticipants": 1,
      "id": 456
    }
  ],
  "targetGroup": [],
  "maximumParticipants": 4,
  "imageUrl": "/api/attachments/inviplay-219209.appspot.com/download/4a3f86b1-9b6f-40d9-9ec0-48e388f19a43",
  "location": {
    "id": 12,
    "name": "Klimhal Mountain Network Arnhem",
    "adress": "Olympus 27",
    "postalCode": "6832 EL",
    "city": "Arnhem",
    "coordinates": {
      "lng": 4.692161717541481,
      "lat": 52.67758735617635
    }
  },
  "activity": {
    "name": "Klimmen",
    "id": 39
  },
  "recurring": "None",
  "tags": ["sia"]
}

Get the details and dates of a specific event.

HTTP Request

GET https://api.inviplay.nl/event/{{eventId}}

Update event

curl -X PUT 'http://api.inviplay.nl/event/123' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
  -H 'Content-Type: application/json' \
  --data-raw '{
    "userId": "f0ce58dc-7861-4307-a86d-090d3941376d",
    "name": "Title of this event",
    "description": "Description of this event",
    "activityId": 47,
    "locationId": 1,
    "maximumParticipants": 4,
    "targetGroup": [1],
    "cost": 300,
    "tags": ["sia"]
}'

This returns the id of the updated event

{
  "id": 123
}

This request returns the updated event.

HTTP Request

PUT http://api.inviplay.nl/event/{{eventId}}

The following fields are the ones that can be changed.

Request body

Parameter Required Type Default Description
userId required String - User Id of the organizer of the event
name required String - Name of the event
description required String - Description of the event
activityId required Number - Id of activity
locationId required Number - Id of location
maximumParticipants required Number -
targetGroup optional Number[] null Array of targetGroup Id's
cost optional int null The costs are handled in cents (cost is without fee, will be included based on business rules)
imageBase64 optional String null Base64 string of image that needs to be uploaded
tags optional String[] null Array of free to choose strings

You have to PUT all of the above fields also if they are not changed, since the complete object will be replaced. If a field is not provided the default value will be stored.

Subscribe or unsubscribe a user to an event

curl -X PUT 'https://api.inviplay.nl/event/{{eventId}}/attendance' \
  -H 'Authorization: Bearer ACCESS_TOKEN'
  -H 'Content-Type: application/json' \
  --data-raw '{
    "userId": "5243a717-7084-4c82-9ea4-7f8f08d63327",
    "dates": [
      {
        "id": 456,
        "attendance": true
      },
      {
        "id": 567,
        "attendance": false
      }
    ],
    "confirmationUrl": "https://yourwebsite.com/thanks"
  }'

Returns success if request is successful

{
  "status": "success",
  "message": "participant successfully signed up to date 456 and signed out of date 567 of event 123",
  "redirectUrl": null
}

If there is a payment needed then a payment url and payment ID will be provided

{
  "status": "pending",
  "message": "payment needed, follow redirect url to complete request",
  "redirectUrl": "https://mollie.com/payment_link/tr_123ae3f",
  "paymentId": 101
}

Endpoint to sign up or signout a user to one or more dates of one event

HTTP Request

PUT https://api.inviplay.nl/event/{{eventId}}/attendance

Request body

Parameter Required Type Default Description
userId required String -
dates required Array - Array of object per date that needs to be updated: { id: [Number], attendance: true / false }
confirmationUrl required String - Url where the user needs to land after a successful payment is made

Activity

An activity is the sport type in the Inviplay database. This is a list of around 50 sport types and new sports will be added now and then.

Get list of sport types

curl 'https://api.inviplay.nl/activity' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \

Returns a list of activities

[
  {
    "id": 1,
    "name": "Voetbal",
    "defaultImageUrl": "/api/attachments/inviplay-219209.appspot.com/download/afad6ead-ef44-4297-943b-317c0648d059.jpg"
  },
  {
    "id": 2,
    "name": "Badminton",
    "defaultImageUrl": "/api/attachments/inviplay-219209.appspot.com/download/2cacbb5d-bf02-4cd6-8bf8-1df6fd924179.jpg"
  },
  {
    "id": 3,
    "name": "Tafeltennis",
    "defaultImageUrl": "/api/attachments/inviplay-219209.appspot.com/download/1860bea4-43fd-4270-ab03-2eb4efb3d633.jpg"
  },
]

Endpoint to get a list of possible sport types

HTTP Request

GET https://api.inviplay.nl/activity

Location

Add location

curl -X POST 'https://api.inviplay.nl/location' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-type: application/json' \
  --data-raw '{
    "name": "Klimhal Mountain Network Arnhem",
    "description": "De grootste klimhal van Arnhem"
    "address": "Olympus 27",
    "city": "Arnhem",
    "postalCode": "6832EL",
    "country": "Nederland",
  }'

Returns the id of the created location

{
  "locationId": 12
}

Endpoint to add a location

HTTP Request

POST https://api.inviplay.nl/location

Request body

Parameter Required Type Default Description
name required String -
address required String -
city required Number -
postalCode required Date -
country required String -
description optional String -

Targetgroup

A targetgroup is used to specify for which people an event is organized. This is a fixed list in the Inviplay database

Get list of target groups

curl 'https://api.inviplay.nl/targetgroup' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \

Returns a list of targetgroups

[
  {
    "id": 1,
    "name": "adults",
  },
  {
    "id": 2,
    "name": "children",
  },
  {
    "id": 3,
    "name": "65+",
  },
]

Endpoint to get a list of possible targetgroups

HTTP Request

GET https://api.inviplay.nl/targetgroup

Payment

Get status of specific payment for specific user

curl 'https://api.inviplay.nl/payment/{{paymentId}}/status/{{userId}}' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \

Returns the status of a payment if exists

{ 
  "status": "paid"
}

Possible values that can be returned:

open | failed | paid | canceled | expired | processing | refunded

Endpoint to get the status of a payment.

HTTP Request

GET https://api.inviplay.nl/payment/{{paymentId}}/status/{{userId}}