API Documentation
Referral API ¶
Get a referral code of a referrer ¶
Get the referral code of a referrer by emailGET/api/referrer/{encodeEmail}/referral-code
Example URI
GET https://referrals.spotahome.com/api/referrer/ZW1haWxAYm9uaWMub20=/referral-code
URI Parameters
- encodeEmail
string(required) Example: ZW1haWxAYm9uaWMub20=email encode using base 64 algorithm
Request
Headers
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"referralCode": "REFERRAL-CODE-MOLT-BONIC"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"referralCode": {
"type": "string"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
404Body
Email not found.Response
422Body
Unprocessable entity. Email is not valid.Response
500Body
Server errorGet data of a referrer ¶
Get the referrer dataGET/api/referrer{?referrerCode}
Example URI
GET https://referrals.spotahome.com/api/referrer?referrerCode=ALBE-MQ-X
URI Parameters
- referrerCode
string(required) Example: ALBE-MQ-XCriteria by referrer code
Request
Headers
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"fistName": "Albert",
"lastName": "Zabala",
"referralCode": "ALBE-MQ-X",
"email": "email@molt-bonic.com"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"fistName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"referralCode": {
"type": "string"
},
"email": {
"type": "string"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
404Body
Referrer not found.Response
422Body
Unprocessable entity. Referral code is not valid.Response
500Body
Server errorCreate a referral code for an email ¶
Create a referrer identified by user emailPOST/api/referrer/external/register
Example URI
POST https://referrals.spotahome.com/api/referrer/external/register
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"email": "email@bonic.om",
"firstName": "first name",
"lastName": "last name"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"email": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
}
},
"required": [
"email"
]
}Response
200Headers
Content-Type: application/jsonResponse
400Body
The body of request is wrong. Check name of field and which fields are required.Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
422Body
Unprocessable entity. Email is not valid.Response
500Body
Server errorDEPRECATED Redeem a referral ¶
DEPRECATED Redeem referralPOST/api/landlord/register
Example URI
POST https://referrals.spotahome.com/api/landlord/register
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"accountId": "aaaa-bbbb-cccc-dddd",
"promoCode": "REFERLAND09283"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"accountId": {
"type": "string"
},
"promoCode": {
"type": "string"
}
},
"required": [
"accountId",
"promoCode"
]
}Response
200Body
The user redeem the referral code.Response
201Body
The user tries to redeem the same code again.Response
400Body
Attributes are requiredResponse
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
403Body
The user registered a different code beforeResponse
404Body
Referral code is not foundResponse
422Body
The request body is not validResponse
500Body
Server errorRedeem a referral code ¶
Redeem referral codePOST/api/referee/redeem
Example URI
POST https://referrals.spotahome.com/api/referee/redeem
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"referralCode": "REFERLAND09283"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"referralCode": {
"type": "string"
}
},
"required": [
"referralCode"
]
}Response
200Body
The user redeem the referral code.Response
201Body
The user tries to redeem the same code again.Response
400Body
Attributes are requiredResponse
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
403Body
The user registered a different code beforeResponse
404Body
Referral code is not foundResponse
422Body
The request body is not validResponse
500Body
Server errorApply a referral code ¶
Apply referral code by only an Admin userPOST/api/referee/apply
Example URI
POST https://referrals.spotahome.com/api/referee/apply
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccBody
{
"accountId": "aaaa-bbbb-cccc-dddd",
"referralCode": "REFERLAND09283"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"accountId": {
"type": "string"
},
"referralCode": {
"type": "string"
}
},
"required": [
"accountId",
"referralCode"
]
}Response
200Body
The user redeem the referral code.Response
201Body
The user tries to redeem the same code again.Response
400Body
Attributes are requiredResponse
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
403Body
The user registered a different code beforeResponse
422Body
Referral code is not validResponse
500Body
Server errorGet a referee ¶
Get the information of a refereeGET/api/referee/u/{userId}
Example URI
GET https://referrals.spotahome.com/api/referee/u/aaaaa-bbbbb-ccccc
URI Parameters
- userId
string(required) Example: aaaaa-bbbbb-ccccc
Request
Headers
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"id": "acc-123",
"referralCode": "referralcode",
"redeemOn": "2018-01-01 00:00"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"referralCode": {
"type": "string"
},
"redeemOn": {
"type": "string"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
404Body
Referee by user id not found.Response
500Body
Server errorDEPRECATED Check if a user has redeemed a referral code ¶
DEPRECATED Has the user redeemed a referral code?GET/api/referee/check/{accountId}
Example URI
GET https://referrals.spotahome.com/api/referee/check/aaaaa-bbbbb-ccccc
URI Parameters
- accountId
string(required) Example: aaaaa-bbbbb-ccccc
Request
Headers
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"registered": true
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"registered": {
"type": "boolean"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
500Body
Server errorDEPRECATED Check if a user has redeemed a referral code ¶
DEPRECATED Has the user redeemed a referral code?GET/api/landlord/check/{accountId}
Example URI
GET https://referrals.spotahome.com/api/landlord/check/aaaaa-bbbbb-ccccc
URI Parameters
- accountId
string(required) Example: aaaaa-bbbbb-ccccc
Request
Headers
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"registered": true
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"registered": {
"type": "boolean"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
500Body
Server errorCreate a referral code for internal user ¶
Create a referrer for internal user, identified by tokenPOST/api/referrer/internal/register
Example URI
POST https://referrals.spotahome.com/api/referrer/internal/register
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonResponse
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
500Body
Server errorGet a referral code for internal in user ¶
Get referral code for internal user, identified by tokenGET/api/referrer/internal/referral-code
Example URI
GET https://referrals.spotahome.com/api/referrer/internal/referral-code
Request
Headers
Content-Type: application/json
Authorization: aa.bb.ccResponse
200Headers
Content-Type: application/jsonBody
{
"referralCode": "ABC-6add-T"
}Schema
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"referralCode": {
"type": "string"
}
}
}Response
401Body
Authentication error. Probably the authorization token is not correct or the user does not have the right role to access this service.Response
500Body
Server error