Skip to content

Instantly share code, notes, and snippets.

@westdavidr
Last active December 10, 2024 13:59
Show Gist options
  • Select an option

  • Save westdavidr/c8890e46a8f06b92df85 to your computer and use it in GitHub Desktop.

Select an option

Save westdavidr/c8890e46a8f06b92df85 to your computer and use it in GitHub Desktop.

Revisions

  1. westdavidr revised this gist Jun 19, 2017. 1 changed file with 17 additions and 17 deletions.
    34 changes: 17 additions & 17 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    ##API URLS
    - **Account Resources**
    + https://beta.youngliving.com/api/accounts
    + https://youngliving.com/api/accounts
    - **Catalog Resources**
    + https://beta.youngliving.com/api/shopping
    + https://youngliving.com/api/shopping
    - **Downline Resources**
    + https://beta.youngliving.com/vo.dlv.api
    + https://youngliving.com/vo.dlv.api

    <hr>

    ##Authentication

    To obtain a token, issue a request to POST https://beta.youngliving.com/api/accounts/token
    To obtain a token, issue a request to POST https://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*.
    @@ -26,7 +26,7 @@ To obtain a token, issue a request to POST https://beta.youngliving.com/api/acco
    **Example request**
    ```
    POST /api/accounts/token HTTP/1.1
    Host: beta.youngliving.com
    Host: youngliving.com
    Content-Type: application/json
    {
    @@ -38,7 +38,7 @@ Content-Type: application/json
    <hr>

    ##Organization
    **Base URL:** https://beta.youngliving.com/vo.dlv.api/downline
    **Base URL:** https://youngliving.com/vo.dlv.api/downline
    ###Endpoints
    - GET /children/user/{periodid}
    - GET /children/member_id/{periodid}
    @@ -52,7 +52,7 @@ Content-Type: application/json
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/children/user/405
    https://youngliving.com/vo.dlv.api/downline/children/user/405
    ```

    Example Response:
    @@ -72,7 +72,7 @@ Example Response:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/children/1223344/405
    https://youngliving.com/vo.dlv.api/downline/children/1223344/405
    ```

    Example Response:
    @@ -94,7 +94,7 @@ Example Response:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/detail/user/405
    https://youngliving.com/vo.dlv.api/downline/detail/user/405
    ```
    Example Response:
    ```json
    @@ -123,7 +123,7 @@ Example Response:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/detail/user/405
    https://youngliving.com/vo.dlv.api/downline/detail/user/405
    ```
    Example Response:
    ```json
    @@ -150,7 +150,7 @@ Example Response:
    ```

    ##Commission
    **Base URL:** https://beta.youngliving.com/vo.dlv.api/commission
    **Base URL:** https://youngliving.com/vo.dlv.api/commission
    ###Endpoints
    - **GET**: /check/summary/{periodid}
    - **GET**: /check/unilevel/{periodid}/{levelnum}
    @@ -163,7 +163,7 @@ Example Response:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/commission/check/summary/405
    https://youngliving.com/vo.dlv.api/commission/check/summary/405
    ```

    Example Result:
    @@ -255,7 +255,7 @@ Example Result:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/405/1
    https://youngliving.com/vo.dlv.api/commission/check/unilevel/405/1
    ```

    Example Result:
    @@ -287,7 +287,7 @@ Example Result:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/commission/history/405
    https://youngliving.com/vo.dlv.api/commission/history/405
    ```

    Example Result:
    @@ -311,13 +311,13 @@ Example Result:
    <hr>

    ##Qualification Endpoints
    - **GET**: https://beta.youngliving.com/vo.dlv.api/downline/qualification/user/period_id
    - **GET**: https://youngliving.com/vo.dlv.api/downline/qualification/user/period_id
    + (0 for current period)

    <hr>

    ##Essential Rewards
    **Base URL:** https://beta.youngliving.com/api/shopping/essential-rewards
    **Base URL:** https://youngliving.com/api/shopping/essential-rewards
    ###Endpoints
    - **GET**: /info

    @@ -327,7 +327,7 @@ Example Result:
    Example Request:
    ```
    GET
    https://beta.youngliving.com/api/shopping/essential-rewards/info
    https://youngliving.com/api/shopping/essential-rewards/info
    ```

    Example Result:
  2. David West revised this gist Nov 27, 2014. 1 changed file with 48 additions and 0 deletions.
    48 changes: 48 additions & 0 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -316,6 +316,54 @@ Example Result:

    <hr>

    ##Essential Rewards
    **Base URL:** https://beta.youngliving.com/api/shopping/essential-rewards
    ###Endpoints
    - **GET**: /info

    ###Examples

    ####Get essential rewards information
    Example Request:
    ```
    GET
    https://beta.youngliving.com/api/shopping/essential-rewards/info
    ```

    Example Result:
    ```json
    {
    "totalPoints": 96,
    "totalExpiringPoints30Days": 0,
    "consecutiveMonthsOfErOrders": 12,
    "earningPercentage": 15,
    "availableMonthlyPoints": 96,
    "monthsBeforePercentageIncrease": 0,
    "nextEarningRate": 0,
    "isEnrolled": true,
    "payments": [ ],
    "legacyOtgProcessingDayOfMonth": 1,
    "legacyNfrProcessingDayOfMonth": 1,
    "isErTemplateConfirmed": true,
    "areErDeliveriesValid": true,
    "doesTemplateMeetMinPv": true,
    "otg": {
    "processingDate": {
    "year": 2014,
    "month": 12,
    "day": 1
    }
    },
    "nfr": {
    "processingDate": {
    "year": 2014,
    "month": 11,
    "day": 1
    }
    }
    }
    ```

    ##Helpers
    ```javascript
    function getPeriodId(date) { // Defaults to Current Period if you leave 'date' empty
  3. David West revised this gist Nov 26, 2014. 1 changed file with 119 additions and 13 deletions.
    132 changes: 119 additions & 13 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -37,17 +37,129 @@ Content-Type: application/json

    <hr>

    ##Organization
    **Base URL:** https://beta.youngliving.com/vo.dlv.api/downline
    ###Endpoints
    - GET /children/user/{periodid}
    - GET /children/member_id/{periodid}
    - GET /detail/user/{periodid}
    - GET /detail/{memberid}/{periodid}

    ###Examples
    - (**0** can be used in place of *{periodid}* for current period)

    ####Get downline for authorized user.
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/children/user/405
    ```

    Example Response:
    ```json
    {
    "customerid": "1449977",
    "currentperiodid": 406,
    "periodid": 405,
    "chartstartperiod": 398,
    "chartendperiod": 405,
    "totalchildren": 74,
    "legs": [ ]
    }
    ```

    ####Get downline for specific user
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/children/1223344/405
    ```

    Example Response:
    ```json
    {
    "customerid": 1223344,
    "currentperiodid": 406,
    "periodid": 405,
    "chartstartperiod": 398,
    "chartendperiod": 405,
    "totalchildren": 15,
    "legs": [ ]
    }
    ```

    <hr>

    ####Get details for authorized user.
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/detail/user/405
    ```
    Example Response:
    ```json
    {
    "customerid": 123456,
    "name": "BLOW, JOE",
    "customertype": 2,
    "email": "test@example.com",
    "mainphone": "1234567891",
    "datesignedup": "5/1/2013 12:27:52 PM",
    "dateactivated": "5/1/2013 12:27:52 PM",
    "onhold": false,
    "activitystatusid": 1,
    "holdreason": "",
    "avatarimage": "",
    "volume": { },
    "rank": { },
    "address": { },
    "autoship": { },
    "sponsor": { },
    "enroller": { }
    }
    ```

    ####Get details for a specific user.
    Example Request:
    ```
    GET
    https://beta.youngliving.com/vo.dlv.api/downline/detail/user/405
    ```
    Example Response:
    ```json
    {
    "customerid": 1223344,
    "name": "MEMBER, COOL",
    "customertype": 2,
    "email": "test@example.net",
    "mainphone": "1234567891",
    "datesignedup": "11/16/2013 12:19:32 PM",
    "dateactivated": "11/16/2013 12:19:32 PM",
    "onhold": false,
    "activitystatusid": 1,
    "holdreason": "",
    "avatarimage": "",
    "volume": { },
    "rank": { },
    "address": { },
    "autoship": { },
    "sponsor": { },
    "enroller": { },
    "sponsorpath": [ ]
    }
    ```

    ##Commission
    **Base URL:** https://beta.youngliving.com/vo.dlv.api/commission
    ####Endpoints
    ###Endpoints
    - **GET**: /check/summary/{periodid}
    - **GET**: /check/unilevel/{periodid}/{levelnum}
    - **GET**: /history/{periodid}

    ####Examples
    ###Examples
    - (**0** can be used in place of *{periodid}* for current period)

    #####Get commission check summary for a specific commission period.
    ####Get commission check summary for a specific commission period.
    Example Request:
    ```
    GET
    @@ -196,20 +308,14 @@ Example Result:
    }
    ```

    ##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)

    <hr>

    ##Qualification Endpoints
    - **GET**: https://beta.youngliving.com/vo.dlv.api/downline/qualification/user/period_id
    + (0 for current period)

    <hr>

    ##Helpers
    ```javascript
    function getPeriodId(date) { // Defaults to Current Period if you leave 'date' empty
  4. westdavidr revised this gist Nov 26, 2014. 1 changed file with 164 additions and 11 deletions.
    175 changes: 164 additions & 11 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -18,8 +18,8 @@ To obtain a token, issue a request to POST https://beta.youngliving.com/api/acco
    **Request body**
    ```
    {
    "memberId": ":member_id",
    "password": ":password"
    "memberId": "",
    "password": ""
    }
    ```

    @@ -30,18 +30,171 @@ Host: beta.youngliving.com
    Content-Type: application/json
    {
    "memberId": ":member_id",
    "password": ":password"
    "memberId": "123456",
    "password": "sosecret"
    }
    ```

    ##Commission Endpoints
    ###Base URL
    https://beta.youngliving.com/vo.dlv.api/commission
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/summary/period_id
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/period_id/level
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/history/period_id
    + (0 for current period)
    <hr>

    ##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:
    ```json
    {
    "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:
    ```json
    {
    "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:
    ```json
    {
    "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
  5. westdavidr revised this gist Nov 25, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ To obtain a token, issue a request to POST https://beta.youngliving.com/api/acco
    - The body of the request must in JSON format with *memberId* and *password*.

    **Request body**
    ```JSON
    ```
    {
    "memberId": ":member_id",
    "password": ":password"
    @@ -36,6 +36,8 @@ Content-Type: application/json
    ```

    ##Commission Endpoints
    ###Base URL
    https://beta.youngliving.com/vo.dlv.api/commission
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/summary/period_id
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/period_id/level
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/history/period_id
  6. westdavidr revised this gist Nov 25, 2014. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -36,8 +36,6 @@ Content-Type: application/json
    ```

    ##Commission Endpoints
    ###Base URL
    https://beta.youngliving.com/vo.dlv.api/commission
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/summary/period_id
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/period_id/level
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/history/period_id
  7. westdavidr revised this gist Nov 25, 2014. 1 changed file with 31 additions and 11 deletions.
    42 changes: 31 additions & 11 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,39 @@
    ##API URLS
    - https://beta.youngliving.com/api/accounts
    - https://beta.youngliving.com/api/shopping
    - https://beta.youngliving.com/vo.dlv.api
    - **Account Resources**
    + https://beta.youngliving.com/api/accounts
    - **Catalog Resources**
    + https://beta.youngliving.com/api/shopping
    - **Downline Resources**
    + https://beta.youngliving.com/vo.dlv.api

    ##Authentication Endpoints
    - **POST** https://beta.youngliving.com/api/accounts/token
    <hr>

    ##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**
    ```JSON
    {
    "email": "<memberId>",
    "memberId": "<memberId>",
    "password": "<password>",
    "userName": "<memberId>"
    "memberId": ":member_id",
    "password": ":password"
    }
    ```

    **Example request**
    ```
    POST /api/accounts/token HTTP/1.1
    Host: beta.youngliving.com
    Content-Type: application/json
    {
    "memberId": ":member_id",
    "password": ":password"
    }
    ```


    ##Commission Endpoints
    ###Base URL
    @@ -43,4 +63,4 @@ function getPeriodId(date) { // Defaults to Current Period if you leave 'date' e
    date = date instanceof Date ? date : new Date();
    return (date.getFullYear() * 12 + date.getMonth() + 1) - (2014 * 12 + 5) + 400;
    }
    ```
    ```
  8. westdavidr revised this gist Nov 25, 2014. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions yl-api-reference.md
    Original file line number Diff line number Diff line change
    @@ -16,6 +16,8 @@


    ##Commission Endpoints
    ###Base URL
    https://beta.youngliving.com/vo.dlv.api/commission
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/summary/period_id
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/period_id/level
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/history/period_id
  9. westdavidr renamed this gist Nov 25, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  10. westdavidr revised this gist Nov 25, 2014. 1 changed file with 15 additions and 11 deletions.
    26 changes: 15 additions & 11 deletions yl-api-reference
    Original file line number Diff line number Diff line change
    @@ -4,13 +4,15 @@
    - https://beta.youngliving.com/vo.dlv.api

    ##Authentication Endpoints
    - **POST**: https://beta.youngliving.com/api/accounts/token
    + <pre>{
    email: *memberId*,
    memberId: *memberId*,
    password: *password*,
    userName: *memberId*
    }</pre>
    - **POST** https://beta.youngliving.com/api/accounts/token
    ```JSON
    {
    "email": "<memberId>",
    "memberId": "<memberId>",
    "password": "<password>",
    "userName": "<memberId>"
    }
    ```


    ##Commission Endpoints
    @@ -34,7 +36,9 @@
    + (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;
    }
    ```javascript
    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;
    }
    ```
  11. westdavidr renamed this gist Nov 25, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  12. westdavidr created this gist Nov 25, 2014.
    40 changes: 40 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    ##API URLS
    - https://beta.youngliving.com/api/accounts
    - https://beta.youngliving.com/api/shopping
    - https://beta.youngliving.com/vo.dlv.api

    ##Authentication Endpoints
    - **POST**: https://beta.youngliving.com/api/accounts/token
    + <pre>{
    email: *memberId*,
    memberId: *memberId*,
    password: *password*,
    userName: *memberId*
    }</pre>


    ##Commission Endpoints
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/summary/period_id
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/check/unilevel/period_id/level
    - **GET**: https://beta.youngliving.com/vo.dlv.api/commission/history/period_id
    + (0 for current period)

    ##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;
    }