##API URLS
- Account Resources
- Catalog Resources
- Downline Resources
##Authentication
To obtain a token, issue a request to POST https://beta.youngliving.com/api/accounts/token
- The request must be a HTTP POST request.
- The request must include a Content-Type header with the value of application/json.
- The body of the request must in JSON format with memberId and password.
Request body
{
"memberId": "",
"password": ""
}
Example request
POST /api/accounts/token HTTP/1.1
Host: beta.youngliving.com
Content-Type: application/json
{
"memberId": "123456",
"password": "sosecret"
}
##Commission Base URL: https://beta.youngliving.com/vo.dlv.api/commission ####Endpoints
- GET: /check/summary/{periodid}
- GET: /check/unilevel/{periodid}/{levelnum}
- GET: /history/{periodid}
####Examples
- (0 can be used in place of {periodid} for current period)
#####Get commission check summary for a specific commission period. Example Request:
GET
https://beta.youngliving.com/vo.dlv.api/commission/check/summary/405
Example Result:
{
"customerid":"123456",
"checkid":"12345678",
"checkdate":"11/17/2014",
"periodid":"405",
"checktotal":"314.39",
"totalcommission":"317.39",
"currencyunit":"USD",
"dgyf":"0",
"paidasrankid":2,
"maxrankid":2,
"volume":{
"ogv":4635.5,
"pv":290.25,
"pgv":4635.5
},
"retail":{
"commission":"11.84"
},
"unilevel":{
"commission":"229.71",
"levels":[
{
"levelnum":1,
"commission":"$142.83"
},
{
"levelnum":2,
"commission":"$63.49"
},
{
"levelnum":3,
"commission":"$23.39"
}
]
},
"faststart":{
"commission":"75.84",
"levels":[
{
"levelnum":1,
"commission":"$8.44"
},
{
"levelnum":2,
"commission":"$67.40"
}
]
},
"personalgen":{
"commission":"0"
},
"generations":{
"commission":"0"
},
"risingstar":{
"commission":"0"
},
"leadership":{
"commission":"0"
},
"diamondexpress":{
"commission":"0"
},
"starterkit":{
"commission":"0"
},
"adjustments":{
"total":"-3",
"items":[
{
"description":"Maintenance Fee",
"amount":"-3",
"commledgertypeid":2
}
]
}
}#####Get commission check details for a specific level in a commission period. Example Request:
GET
https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/405/1
Example Result:
{
"customerid":123456,
"periodid":406,
"commissionvolume":1785,
"percentage":8,
"commissionearned":"$142.83",
"unilevel":{
"levels":[
{
"membernum":123445,
"membername":"MEMBER, COOL",
"commissionvolume":75.25,
"percentage":8.0,
"commissionsearned":6.02
},
...
]
}
}#####Get commission check details for a specific level in a commission period. Example Request:
GET
https://beta.youngliving.com/vo.dlv.api/commission/history/405
Example Result:
{
"customerid":1449977,
"checks":[
{
"periodid":405,
"checknumber":"12345678",
"checkdate":"11/17/2014",
"amount":317.39,
"amountformatted":"$317.39",
"currency":"USD"
},
...
]
}##Organization Endpoints
- GET: https://beta.youngliving.com/vo.dlv.api/downline/children/user/period_id
- (0 for current period)
- GET: https://beta.youngliving.com/vo.dlv.api/downline/children/member_id/period_id
- (0 for current period)
- GET: https://beta.youngliving.com/vo.dlv.api/downline/detail/user/period_id
- (0 for current period)
- GET: https://beta.youngliving.com/vo.dlv.api/downline/detail/member_id/period_id
- (0 for current period)
##Qualification Endpoints
- GET: https://beta.youngliving.com/vo.dlv.api/downline/qualification/user/period_id
- (0 for current period)
##Helpers
function getPeriodId(date) { // Defaults to Current Period if you leave 'date' empty
date = date instanceof Date ? date : new Date();
return (date.getFullYear() * 12 + date.getMonth() + 1) - (2014 * 12 + 5) + 400;
}
@westdavidr I was testing the API calls with postman, and YL updated the base URL and the required fields in the payload. I forked and updated your gist. Can you review an merge it?