API Documentation

# SearchDates:

URL: /api/search_dates/{language}/

Accepted methods: GET

method read(language=sl):

Returns a list of all dates that you can search together with friendly locale strings. Useful to show in drop-down listing.

Optional:
language (default='sl') - language of search results. Support only 'sl' for now.

# GeonamesLookup:

URL: /api/geonames/lookup

Accepted methods: GET, POST

method read():

Suggests canonical city name for input. Useful for partial searches and autosuggest widgets. It knows about alternative names (e.g. Vienna - Wien) and ascii names. When more than one city matches, returns one with bigger population first.

Parameters:
  • query - query for a city (e.g. Ljubljana)
  • country - country in iso_alpha2 format
method create():

# StatusAccounts:

URL: /api/accounts/status

Accepted methods: GET

method read():

Returns information if the user is logged in.

Response: is_authenticated: true or false apikey: users unique apikey that can be used to log them in

# LoginApikeyAccounts:

URL: None

Accepted methods: POST

method create():

Logs user into the system using apikey that is retrieved using Status Accounts method.

Example apikey (unused): ZvPA2Ro2NswoY2HDrGDiBZNudaaVvHZHI9aKzX5klE0

POST Parameters:
apikey

# LogoutAccounts:

URL: /api/accounts/logout

Accepted methods: GET

method read():

Logs out the user from active session.

Returns the new is_authenticated status.

# Carshare:

URL: /api/carshare/{id}/

Accepted methods: GET

method read(id):

Detailed information about a specific carshare (ride). Only public rides that don't have a transfer time older than 14 days are displayed.

This information should not be cached for more than a few minutes as users can edit and delete their rides.

Parameters:
id - id of the carshare

# SearchCarshares:

URL: /api/search/{search_type}/

Accepted methods: GET

method read(search_type):

Searches for available carshares.

There are three types of search:
  • seekers - people looking for rides
  • shares - people offering rides
  • international - cross-border offers for rides (not implemented yet)
You can add additional search options as GET parameters:
  • f - from city (requires also country)
  • fc - from country in iso_alpha2 format (e.g. SI for Slovenia or AT for Austria)
  • t - destination city
  • tc - destination country in iso_alpha2 format (e.g. SI for Slovenia or AT for Austria)
  • d - date in YYYY-MM-DD format, defaults to todays date
Example request:
https://prevoz.org/api/search/shares/?f=Ljubljana&fc=SI

# CreateCarshare:

URL: /api/carshare/create/

Accepted methods: POST, GET

method read():
method create():

Creates a new carshare. User most be logged in.

POST parameters:
  • transptype: 0 - offering a ride, 1 - looking for a ride
  • transpfrom: originating city
  • transpfromcountry - originating country in iso_alpha2 format (e.g. SI for Slovenia or AT for Austria)
  • transpto: destination city
  • transptocountry: destionation city in iso_alpha2 format
  • transpdate: date when the user is offering or looking for a ride in YYYY-MM-DD format
  • transptime: time when the ride is offered or looked for in 'hh:mm' format
  • transpppl: number of free seats/people - min: 1, max: 6
  • transpprice: asked price in EUR (optional)
  • transpphone: contact (phone) information
  • transpdescr: additional comments (optional)
  • transpinsured: user indicated that she has insurance for passengers

If the method is successful it returns id of the created carshare.

# ListCarshare:

URL: /api/carshare/list/

Accepted methods: GET

method read():

Lists active carshares for logged in user. Active carshare is one that has transfer date equal to today or greater.

There are no input parameters.

# FullCarshare:

URL: /api/carshare/full/{id}/

Accepted methods: POST

method create(id):

Marks/unmarks a carshare as full. User must be logged-in and must be author of the carshare.

Parameters:
id - id of the carshare
POST parameters:
state - 'full' or 'available'

# DeleteCarshare:

URL: /api/carshare/delete/{id}

Accepted methods: GET, POST

method read(id):
method create(id):

Deletes a carshare. User must be logged-in and must be author of the carshare.

Parameters:
id - id of the carshare

# UpdateCheck:

URL: None

Accepted methods: GET

method read():

Based on provided platform and version number, this call returns if it's the latest version of the app and provides info on where to get newest version.

GET Parameter:
  • platform: string, e.g. android
  • version: string, e.g. 1.2.0
Returns:
  • is_latest: true or false or unknown
  • url: url to the newest version
  • version: version identifier of the latest version
  • description: optional short description of why upgrade