Expedition Grundeinkommen API (1.0.0)

Download OpenAPI specification:Download

This is the documentation for the api of the open source web application part of the Expedition Grundeinkommen campaign.

Github Repos:

Back End: https://github.com/grundeinkommensbuero/backend

Web Application: https://github.com/grundeinkommensbuero/website

Admin Panel: https://github.com/grundeinkommensbuero/admin

Authentication

ApiKeyAuth

Security Scheme Type API Key
Header parameter name: Authorization

AdminApiKeyAuth

Security Scheme Type API Key
Header parameter name: Authorization

ParamApiKeyAuth

Security Scheme Type API Key
Query parameter name: token

BasicAuth

Security Scheme Type HTTP
HTTP Authorization Scheme basic

Creates a new anonymous signature list

Request Body schema: application/json

Object containing info for signature list

campaignCode
required
string

Responses

Request samples

Content type
application/json
{
  • "campaignCode": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "signatureList": {
    }
}

Updates a signature list (register signatures)

path Parameters
listId
required
string

List id of the signature list to be changed

Request Body schema: application/json

Object containing info about user and how many signatures to register

userId
string
email
string
count
required
integer

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "email": "string",
  • "count": 0
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Creates a new user

Request Body schema: application/json

User object that is created

userId
required
string
email
required
string
newsletterConsent
required
boolean

Subscription to general newsletter

referral
string
name
string
city
string
zipCode
string
source
string
ags
string

If user should be signed up for municipality

Array of objects

If omitted, newsletter settings will be configured on the basis of the ags. Will override existing newsletter settings.

object

Should either include inGeneral or meetup if it should be saved that the user either wants to collect in general or at a specific event.

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "email": "string",
  • "newsletterConsent": true,
  • "referral": "string",
  • "name": "string",
  • "city": "string",
  • "zipCode": "string",
  • "source": "string",
  • "ags": "string",
  • "customNewsletters": [
    ],
  • "wantsToCollect": {
    }
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "user": {
    }
}

Creates a new user from an external source

Authorizations:
Request Body schema: application/json

User object that is going to be created

email
required
string
username
required
string

Must be at least 3 chars

ags
required
string
optedIn
required
boolean
isEngaged
required
boolean
loginToken
string

Token to later use for login, key can not be defined or value null

userToken
string

MGE specific token, key can not be defined or value null

phone
string

Key can not be defined or value null, must be at least 6 digits

Responses

Request samples

Content type
application/json
{
  • "email": "string",
  • "username": "string",
  • "ags": "string",
  • "optedIn": true,
  • "isEngaged": true,
  • "loginToken": "string",
  • "userToken": "string",
  • "phone": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "data": {
    }
}

Gets user

path Parameters
userId
required
string

User id of user who should be retrieved

Responses

Response samples

Content type
application/json
{
  • "user": {
    }
}

Updates a user

Authorizations:
path Parameters
userId
required
string

User id of user whom should be updated

Request Body schema: application/json

For now only newsletter consent, zip code, username and city can be updated

ags
string

If user should be signed up for municipality

newsletterConsent
boolean

Subscription to general newsletter

reminderMails
boolean

Subscription to automated mails

zipCode
string
username
string
city
string
confirmed
boolean
removeToken
boolean

If this flag is set the custom token will be removed from the user

code
string

The code used for double opt in, needs to be saved when confirming user

lottery
string

Identifier of the lottery campaign (e.g. just the year '2021')

object
Array of objects

Array holding information about the newsletters the user is subscribed to

updatedOnXbge
boolean
store
object

Can contain any key. All keys will be added to existing store. If a key already exists it will be overwritten.

listFlow
object

Can contain any key. All keys will be added to existing list flow. If a key already exists it will be overwritten.

object

Should either include inGeneral or meetup if it should be saved that the user either wants to collect in general or at a specific event.

Responses

Request samples

Content type
application/json
{
  • "ags": "string",
  • "newsletterConsent": true,
  • "reminderMails": true,
  • "zipCode": "string",
  • "username": "string",
  • "city": "string",
  • "confirmed": true,
  • "removeToken": true,
  • "code": "string",
  • "lottery": "string",
  • "donation": {
    },
  • "customNewsletters": [
    ],
  • "updatedOnXbge": true,
  • "store": { },
  • "listFlow": { },
  • "wantsToCollect": {
    }
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Delete user (in dynamo and cognito)

Authorizations:
path Parameters
userId
required
string

User id of user who should be deleted

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

Gets current authenticated user

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "user": {
    }
}

Creates a new signature list for a user

The newsletter consent is set to true when calling this endpoint

Authorizations:
path Parameters
userId
required
string

User id for whom we create a signature list

Request Body schema: application/json

Object containing info for signature list

campaignCode
required
string

Responses

Request samples

Content type
application/json
{
  • "campaignCode": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "signatureList": {
    }
}

Creates a new interaction for a specific user

path Parameters
userId
required
string

User id of user for whom a interaction should be created

Request Body schema: application/json

interaction object that is added

body
string
type
required
string
campaignCode
string

Responses

Request samples

Content type
application/json
{
  • "body": "string",
  • "type": "string",
  • "campaignCode": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "interaction": {
    }
}

Updates an existing interaction for a specific user

path Parameters
userId
required
string

User id of user for whom a interaction should be updated

interactionId
required
string

Id of interaction to be updated

Request Body schema: application/json

Key/values which should be updated. You can also add any other new key.

body
string
type
string
campaignCode
string
property name*
any

Responses

Request samples

Content type
application/json
{
  • "body": "string",
  • "type": "string",
  • "campaignCode": "string"
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Creates a survey answer for a specific user

path Parameters
userId
required
string

User id of user for whom a survey answer should be created

Request Body schema: application/json

Survey object that is created

surveyCode
required
string
answer
required
string

Responses

Request samples

Content type
application/json
{
  • "surveyCode": "string",
  • "answer": "string"
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Mailjet callback to unsubscribe user

Special api function to serve as callback for (mailjet unsubscribe event)[https://dev.mailjet.com/email/guides/webhooks/]

Authorizations:
Request Body schema: application/json

Event array coming from mailjet

Array ()
email
string

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "message": "string"
}

Mailjet callback to update user if they opened or clicked an email

Special api function to serve as callback for (mailjet events)[https://dev.mailjet.com/email/guides/webhooks/]

Authorizations:
Request Body schema: application/json

Event array coming from mailjet

Array ()
email
string
event
string

Responses

Request samples

Content type
application/json
[
  • {
    }
]

Response samples

Content type
application/json
{
  • "message": "string"
}

Creates a new pledge and a new user

Authorizations:
path Parameters
userId
required
string

User id of user whose pledges should be updated

Request Body schema: application/json

Pledge object that is created

pledgeId
required
string
signatureCount
integer
message
string

Responses

Request samples

Content type
application/json
{
  • "pledgeId": "string",
  • "signatureCount": 0,
  • "message": "string"
}

Response samples

Content type
application/json
{
  • "message": "string",
  • "userId": "string",
  • "pledge": {
    }
}

Updates user by adding a new pledge

If a pledge for the passed pledgeId already exists it is updated, if not a new pledge is created

Authorizations:
path Parameters
userId
required
string

User id of user whose pledges should be updated

Request Body schema: application/json

Pledge object that is added

pledgeId
required
string
signatureCount
integer
message
string

Responses

Request samples

Content type
application/json
{
  • "pledgeId": "string",
  • "signatureCount": 0,
  • "message": "string"
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Get all interactions (of a certain type if parameter is passed)

query Parameters
limit
integer

If passed only this number of interactions will be returned. Default is 10.

type
string

If passed only interactions with this type will be passed

campaignCode
string

If passed only interactions with this campaign code will be passed

Responses

Response samples

Content type
application/json
{
  • "message": "string",
  • "interactions": [
    ]
}

Creates a new user or multiple users as admin

Authorizations:
Request Body schema: application/json

User object that is created

campaignCode
required
string
emails
required
Array of strings

Responses

Request samples

Content type
application/json
{
  • "campaignCode": "string",
  • "emails": [
    ]
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Gets list of power users

Authorizations:
query Parameters
minimum
integer

Users who have sent or registered more than minimum will be retrieved

Responses

Response samples

Content type
application/json
{
  • "count": 0,
  • "users": [
    ]
}

Updates user as an admin

So far you can only unsubscribe user or cancel donation.

Authorizations:
Request Body schema: application/json

Basically the action that should be invoked

object
newsletterConsent
boolean

Should only be false, if true nothing happens.

Responses

Request samples

Content type
application/json
{
  • "donation": {
    },
  • "newsletterConsent": true
}

Response samples

Content type
application/json
{
  • "message": "string"
}

Deletes user as an admin

User is deleted in Cognito and Dynamo

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}

Updates a signature list as an admin

Through this endpoint received signatues can be registered

Authorizations:
path Parameters
listId
required
string

List id of the signature list to be changed

Request Body schema: application/json

Object containing info about user and how many signatures to register

count
required
integer
mixed
required
boolean

Responses

Request samples

Content type
application/json
{
  • "count": 0,
  • "mixed": true
}

Response samples

Content type
application/json
{
  • "isAnonymous": true,
  • "mailMissing": true
}

Gets list of donations

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "donations": {
    }
}

Gets list of collectors

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "inGeneral": [ ],
  • "meetups": [
    ]
}

Create a signed url to upload image

Authorizations:
Request Body schema: application/json

Object containing info for image

userId
required
string
contentType
required
string

Content type of image (e.g. image/png)

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "contentType": "string"
}

Response samples

Content type
application/json
{
  • "uploadUrl": "string"
}

Gets signature counts for one user

query Parameters
userId
string

User id for whom we want to get the signature count

email
string

Email of user for whom we want to get the signature count

listId
string

List id which should belong to a user for whom we want to get the signature count

Responses

Response samples

Content type
application/json
{
  • "received": 0,
  • "scannedByUser": 0,
  • "receivedList": [
    ],
  • "scannedByUserList": [
    ]
}

Gets signature counts for all campaigns

Responses

Response samples

Content type
application/json
{
  • "keyOfCampaign": {
    }
}

Get history of registered signatures

query Parameters
start
string

Date (YYYY-MM-DD) when the history should start, if not provided 6 weeks ago

end
string

Date (YYYY-MM-DD) when the history should end, if not provided now

Responses

Response samples

Content type
application/json
{
  • "keyOfCampaign": {
    }
}

Get user count for all campaigns

Responses

Response samples

Content type
application/json
{
  • "totalCount": {
    },
  • "keyOfCampaign": {
    }
}

Gets count of active users

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Gets signature list counts for all campaigns

Responses

Response samples

Content type
application/json
{
  • "keyOfCampaign": {
    }
}

Gets statistics for one municipalities

Takes ags as path param to get stats for a specific municipality

path Parameters
ags
required
string

Allgemeiner Gemeindeschlüssel to get stats for specific municipality

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Gets statistics for all municipalities

query Parameters
all
any

Pass e.g. true (or any other string, we just check if the param is there). If param is set all municipalities including goals will be returned.

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Gets all municipalities

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Gets info (without stats) for one municipalities

Takes ags as path param to get info for a specific municipality

path Parameters
ags
required
string

Allgemeiner Gemeindeschlüssel to get specific municipality

Responses

Response samples

Content type
application/json
{
  • "data": {
    }
}

Gets list of sold vouchers

Authorizations:
query Parameters
safeAddress
string

If passed only vouchers sold to this safeAddress are returned

timestamp
string

Timestamp as iso string. Only vouchers sold after this date are returned.

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}

Purchase voucher of specific provider

Authorizations:
Request Body schema: application/json

Object containing voucher info

providerId
required
string
amount
required
number
safeAddress
required
string
transactionId
required
string

Responses

Request samples

Content type
application/json
{
  • "providerId": "string",
  • "amount": 0,
  • "safeAddress": "string",
  • "transactionId": "string"
}

Response samples

Content type
application/json
{
  • "data": {
    }
}

Gets list of providers and their count of available vouchers

Authorizations:

Responses

Response samples

Content type
application/json
{
  • "data": [
    ]
}