BilBasen's external web API
All calls to the BilBasen web services must include an api key in the headers:

apikey: {key}

All services return JSON only. Specify application/json as the accept type in all requests:

Accept: application/json

You can also include the BilBasen application version in the Accept header:

Accept: application/bilbasen+6.0.json

Furthermore, the result can be compressed by specifying:

Accept-encoding: gzip

Contents:


OAuth authorization

Authorizes user and returns oauthresponse, including accesstoken

POST /oauth/accesstoken

Parameters username and password must be passed in the body of the request.
Parameter Type Description
username string Username of user
password string Password of user

Refreshes authorization and returns oauthresponse, including new accesstoken

/oauth/refreshtoken

Parameter Type Description
refreshtoken guid refreshtoken obtained by calling accesstoken earlier on

logs out the user by expiring the accesstoken

/oauth/logout

Parameter Type Description
accesstoken guid accesstoken obtained by calling accesstoken earlier on

Contact seller of ad

ads/contactseller/{adId}

Example:

Send mail to seller:
http://api.bilbasen.dk/ads/contactseller/1234?message=Hello&sendername=karsten&senderemail=karsten@foo.com&senderphone=28685361&receivecopy=false

Parameter Type Description
message string This message will be included in the mail, besides the standard text.
sendername string The name of the sender.
senderemail string The email of the sender.
senderphone string The phone of the sender.
receivecopy boolean Will sender be receiving a copy of the mail.

User services

Show user info for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

/user

Example:

Show user details:
http://api.bilbasen.dk/user

Create a BilBasen user

An error will be returned if required fields are not filled out or if e-mail address is not unique

POST /user

POST /userwithoauthautorization

POST /userreturnpassword

Example:

http://api.bilbasen.dk/user?birthyear=1978&firstname=John&lastname=Doe&phone1=12345678&email=john@doe.com&servicemails=false&zipcode=8000&city=aarhus&newsletter=true&sex=M (BEMÆRK: Skal udføres som POST)

Parameter Type Description Default
birthYear int User birth year
firstname string User first name(s)
lastname string User last name(s)
phone1 int User phone number
phone2 int User alternate phone number
email string User e-mail address None (must be specified)
password string User password None (must be specified)
serviceMails boolean Specifies whether the user wants to receive service mails None (must be specified)
thirdPartyMail boolean Specifies whether the user wants to receive third party mails None (must be specified)
advertisingMail boolean Specifies whether the user wants to receive advertising mails None (must be specified)
newsletter bool Specifies whether the user wants to receive the newsletter None (must be specified)
street string User street name
houseNumber int User house number
letter char User address letter
floor string User address floor
floorSide string User address floor side
zipCode int User zip code
city string User city name
sex char User gender
M = Male
F = Female

Update en BilBasen bruger

User name and password is the same as is used when logging on to BilBasen
An error will be returned if required fields are not filled out or if phone number or e-mail address is not unique

PUT /user

Example:

http://api.bilbasen.dk/user?birthyear=1978&firstname=John&lastname=Doe&phone1=12345678&email=john@doe.com&servicemails=false&zipcode=8000&city=aarhus&newsletter=true&sex=M (BEMÆRK: Skal udføres som PUT)

Parameter Type Description Default
birthYear int User birth year
firstname string User first name(s)
lastname string User last name(s)
phone1 int User phone number
phone2 int User alternate phone number
email string User e-mail address None (must be specified)
password string User password None (must be specified)
serviceMails boolean Specifies whether the user wants to receive service mails None (must be specified)
thirdPartyMail boolean Specifies whether the user wants to receive third party mails None (must be specified)
advertisingMail boolean Specifies whether the user wants to receive advertising mails None (must be specified)
newsletter bool Specifies whether the user wants to receive the newsletter None (must be specified)
street string User street name
houseNumber int User house number
letter char User address letter
floor string User address floor
floorSide string User address floor side
zipCode int User zip code
city string User city name
sex char User gender
M = Male
F = Female

Show BilBasen user vehicles

User name and password is the same as is used when logging on to BilBasen

/user/vehicles

Example:

Show user vehicles:
http://api.bilbasen.dk/user/vehicles

Update or set user mails subscription

User name and password is the same as is used when logging on to BilBasen

user/setusermailsubScriptions/{serviceMail}/{newsletter}/{advertisingMail}/{thirdPartMail}

Example:

Update mails subscription:
http://api.bilbasen.dk/user/setusermailsubScriptions/true/true/true/true

Show BilBasen user vehicles saved ads (obsolete)

User name and password is the same as is used when logging on to BilBasen
This endpoint is obsolete. Use /favorites/ below.

/user/savedads

Example:

Show user saved ads:
http://api.bilbasen.dk/user/savedads

Show BilBasen user's favorite vehicles

User name and password is the same as is used when logging on to BilBasen
Example:

Get user favorite vehicles:
http://api.bilbasen.dk/favorites/

Parameters: sortby and sortdirection work like for search, e.g. http://api.bilbasen.dk/favorites/?sortby=price&sortdirection=desc

Show BilBasen favorite vehicles from vehicle IDs

User name and password is the same as is used when logging on to BilBasen
Example:

Get favorite vehicles:
http://api.bilbasen.dk/favorites/1,3,5

Parameters: sortby and sortdirection work like for search, e.g. http://api.bilbasen.dk/favorites/1,3,5?sortby=price&sortdirection=desc

Synchronize BilBasen user's favorite vehicles

Adds the list of ads to the user's favorite vihicles. If the vihicle no longer exists or has already been added, it will not be added.
User name and password is the same as is used when logging on to BilBasen
Example:

Get user favorite vehicles:
http://api.bilbasen.dk/favorites/sync?adIds=1,3,5 (NOTE: Must be done as POST)

Create saved ad for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

POST /user/savedads

Eksempel:

Creates saved ad for ad with the id 42. The 'adId' parameter must be encoded in POST body:
http://api.bilbasen.dk/user/savedads (NOTE: Must be done as POST)

Alternatively adId can be specified as a request parameter:
http://api.bilbasen.dk/user/savedads?adId=42 (NOTE: Must be done as POST)

Delete saved ad for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

UPDATE: uses globalId to delete a savedad

DELETE /user/savedads/{globalId}

Example:

Deletes saved ad with the id 113. 'globalId' is shown in each ad returned in the list of the user's saved ads:
http://api.bilbasen.dk/user/savedads/113 (NOTE: Must be done as DELETE)

Parameter Type Description
savedAdId int Id of the saved ad

Show search agents for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

/user/searchagents

Example:

Fetches all search agents for active BilBasen user:
http://api.bilbasen.dk/user/searchagents

Accept latest terms of service for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

/user/acceptlatestterms

Example:

Accepts latest terms of service for active BilBasen user:
http://api.bilbasen.dk/user/acceptlatestterms

Query whether latest terms of service for a BilBasen user has been accepted

User name and password is the same as is used when logging on to BilBasen

user/hasacceptedlatestterms

Example:

Returns whether the latest terms has been accepted and the corresponding text:
http://api.bilbasen.dk/user/hasacceptedlatestterms

Get latest terms of service text

/latesttermsofservicehtml

Example:

Returns terms of service text in html:
http://api.bilbasen.dk/latesttermsofservicehtml

Get latest mobile terms and conditions text

/mobiletermsandconditions

Example:

Returns terms and conditions text in html:
http://api.bilbasen.dk/mobiletermsandconditions

Send forgotten password

Email is the forgetfull users email

/sendforgottenpassword/{email}

Example:

Sends password in email to a user with the address foo@foo.com:
http://api.bilbasen.dk/sendforgottenpassword/foo@foo.com

Create search agent for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

POST /user/searchagents

Example:

Create search agent for the active BilBasen user on vehicles from 2006-2008 with automatic transmission:
http://api.bilbasen.dk/user/searchagents?automaticGear=true&yearFrom=2006&yearTo=2008 (BEMÆRK: Skal udføres som POST)

Parameter Type Description Default
adsFrom int Show only ads from dealers or private users. 1 = dealers, 2 = private users 1
automaticGear boolean Automatic transmission false
category string Vehicle category. The list of possible vehicles is available at /metadata/categories/car P (personbil)
colorName string Vehicle color
commentToDealer string Comment to seller
dealerCall boolean Specifies whether a dealer can call the user if the search agent yields new ads false
drivewheel char Specifies the drive wheel. F = frontwheel, B = backwheel, 4 = fourwheeldrive
doors int Number of doors
esp boolean ESP installed false
fuel int Fuel
0 = All
1 = Gasoline
2 = Diesel
3 = Electric
4 = E85
5 = GAS
6 = GasolineAndElectric
7 = GasolineAndGas
8 = DieselAndElectric
9 = BioDiesel
10 = DieselAndBiodiesel
0
geartype char Specifies the gear type. A = automatic, M = manual
make string Vehicle make. Make list is available at /metadata/makes/car.
maxDistance int Maximum distance to seller (km)
0 = All
25 = upto25
50 = upto50
100 = upto100
150 = upto150
1000 = West
2000 = East
0
mileageFrom int Minimum mileage (km) 0
mileageTo int Maximum mileage (km) 99999999
model string Model
mot boolean Newly MOT tested (nysynet) false
ownerZip int User zip code
powerAssistedSteering bool Power assisted steering false
priceFrom int Minimum price 0
priceTo int Maximum price 9999999
replyType int How to contact user
0 = ByEmail
1 = BySms
2 = None
0
searchable int Create search agent as ad, visible to interested buyers false
smsPhone int Phone number for SMS/text message. Used only when replyType is set to 1 (BySms).
tax boolean Tax paid. true = yes, false = no, not specified = both
topspeedmin int Minimum topspeed
topspeedmax int Maximum topspeed
torquemin int Minimum torque
torquemax int Maximum torque
towbar boolean Towbar false
type int Vehicle type. Types are available at /metadata/types/car.
variant string Vehicle variant. Variants are available at /metadata/variants/car/{makeId}/{modelId}/{year}/{fueltypeId}
ventilation boolean Aircondition false
yearFrom int Minimum vehicle year 1900
yearTo int Maximum vehicle year 2018

Update search agent for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

PUT /user/searchagents/{searchAgentId}

Example:

Update search agent for the active BilBasen user for which the search agent id is 42:
http://api.bilbasen.dk/user/searchagents/42?automaticGear=false (NOTE: Must be done as PUT)

Parameter Type Description Default
searchAgentId int Search agent id
adsFrom int Show only ads from dealers or private users. 1 = dealers, 2 = private users 1
automaticGear boolean Automatic transmission false
category string Vehicle category. The list of possible vehicles is available at /metadata/categories/car P (personbil)
colorName string Vehicle color
commentToDealer string Comment to seller
dealerCall boolean Specifies whether a dealer can call the user if the search agent yields new ads false
drivewheel char Specifies the drive wheel. F = frontwheel, B = backwheel, 4 = fourwheeldrive
doors int Number of doors
esp boolean ESP installed false
fuel int Fuel
0 = All
1 = Gasoline
2 = Diesel
3 = Electric
4 = E85
5 = GAS
6 = GasolineAndElectric
7 = GasolineAndGas
8 = DieselAndElectric
9 = BioDiesel
10 = DieselAndBiodiesel
0
geartype char Specifies the gear type. A = automatic, M = manual
make string Vehicle make. Make list is available at /metadata/makes/car.
maxDistance int Maximum distance to seller (km)
0 = All
25 = upto25
50 = upto50
100 = upto100
150 = upto150
1000 = West
2000 = East
0
mileageFrom int Minimum mileage (km) 0
mileageTo int Maximum mileage (km) 99999999
model string Model
mot boolean Newly MOT tested (nysynet) false
ownerZip int User zip code
powerAssistedSteering bool Power assisted steering false
priceFrom int Minimum price 0
priceTo int Maximum price 9999999
replyType int How to contact user
0 = ByEmail
1 = BySms
2 = None
0
searchable int Create search agent as ad, visible to interested buyers false
smsPhone int Phone number for SMS/text message. Used only when replyType is set to 1 (BySms).
tax boolean Tax paid. true = yes, false = no, not specified = both
topspeedmin int Minimum topspeed
topspeedmax int Maximum topspeed
torquemin int Minimum torque
torquemax int Maximum torque
towbar boolean Towbar false
type int Vehicle type. Types are available at /metadata/types/car.
variant string Vehicle variant. Variants are available at /metadata/variants/car/{makeId}/{modelId}/{year}/{fueltypeId}
ventilation boolean Aircondition false
yearFrom int Minimum vehicle year 1900
yearTo int Maximum vehicle year 2018

Delete search agent for a BilBasen user

User name and password is the same as is used when logging on to BilBasen

DELETE /user/searchagents/{searchAgentId}

Example:

Delete the search agent with id 42:
http://api.bilbasen.dk/user/searchagents/42 (NOTE: Must be done as DELETE)

Parameter Type Description
searchAgentId int Search agent id

Metadata services

Fetch info from license plater number

/metadata/licenseplate/{licenseplate}

Example:

Show details of possible vehicle models:
http://api.bilbasen.dk/metadata/licenseplate/VS90578

Parameter Type Description
licenseplate string The license plate

Fetch all makes

/metadata/makes/car

Example:

Fetch all makes:
http://api.bilbasen.dk/metadata/makes/car

     

Fetch metadta for year, mileage and prices

/metadata/basics

Example:

Fetch :
http://api.bilbasen.dk/metadata/basics

     

Fetch models in a make

/metadata/models/car/{makeId}

Example:

Fetch all Audi models:
http://api.bilbasen.dk/metadata/models/car/AU

Parameter Type Description
makeId string Make id

Get fuelconsumption, i.e. 'Energimærke'

metadata/fuel/getfuelconsumption/{fueltype}/{kml}

Example:

Get fuelconsumption when fueltype is 1 and kml is 10:
http://api.bilbasen.dk/metadata/fuel/getfuelconsumption/1/10

Parameter Type Description
fueltype int Fueltype id
kml int Kilometers pr. L

Fetch models in a make given a category

/metadata/models/vehicles/{makeId}

Example:

Fetch all Audi models in category P:
http://api.bilbasen.dk/metadata/models/vehicles/AU?category=P

Parameter Type Description
makeId string Make id
category string category

Fetch all makes and their models

/metadata/makes/models/car

Example:

Fetch all makes and their models:
http://api.bilbasen.dk/metadata/makes/models/car

     

Fetch search categories

/metadata/categories/car

Example:

Fetch categories:
http://api.bilbasen.dk/metadata/categories/car

     

Fetch vehicle colors

/metadata/colors/car

Example:

Fetch vehicle colors:
http://api.bilbasen.dk/metadata/colors/car

     

Fetch fuel types

/metadata/fueltypes/car

Example:

Fetch fuel types:
http://api.bilbasen.dk/metadata/fueltypes/car

Fetch equipment types

/metadata/equipment/car

Example:

Fetch equipment types:
http://api.bilbasen.dk/metadata/equipment/car