# Manage Network

## Referral Downline List&#x20;

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/referraldownline/`

This API endpoint will return list of referral downline.

#### Query Parameters

| Name           | Type   | Description                               |
| -------------- | ------ | ----------------------------------------- |
| offset         | string |                                           |
| limit          | string |                                           |
| list\_type     | string | Possible values are "overall" and "month" |
| username       | string | username                                  |
| currency\_code | string | currency code                             |
| from\_date     | string | format - MM/DD/YY                         |
| to\_date       | string | format - MM/DD/YY                         |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "uid_id": <uid>,
                "username": "<username>",
                "name": "<name>",
                "sponsor": "<sponsor_username>",
                "sale": "<sale>",
                "earned": "<earned>",
                "rank": {
                    "title": "<rank_name>",
                    "image": "<rank_image>"
                },
                "package": {
                    "package_name": "<package_name>",
                    "package_image": "<package_image>"
                },
                "created": "<registerd_date>"
            },
            ...
        ],
        "count": <list_count>,
        "previous": <previous_page>,
        "next": <next_page>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```javascript
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/referraldownline/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/referraldownline/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_POSTFIELDS => array(),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

#### Error Responses

| Status Code | Error Type       | FIeld          | Description                            |
| ----------- | ---------------- | -------------- | -------------------------------------- |
| 400         | Validation Error | list\_type     | Invalid list type. Please check again. |
| 400         | Validation Error | currency\_code | Invalid Currency Code.                 |
| 400         | Validation Error | username       | Invalid username.                      |

## Team Downline List

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/teamdownline/`

This API endpoint will return list of team downline users.&#x20;

#### Query Parameters

| Name       | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| limit      | string |                                           |
| offset     | string |                                           |
| from\_date | string | format - MM/DD/YY                         |
| to\_date   | string | format - MM/DD/YY                         |
| list\_type | string | Possible values are "overall" and "month" |
| username   | string | username                                  |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "uid_id": <uid>,
                "username": "<username>",
                "name": "<name>",
                "parent": "<parent_username>",
                "level": <level>,
                "sale": "<sale>",
                "rank": {
                    "title": "<rank_title>",
                    "image": "<rank_image>"
                },
                "package": {
                    "package_name": "<package_name>",
                    "package_image": "<package_image>"
                },
                "created": "<registerd_date>"
            },
            ...
        ],
        "count": <list_count>,
        "previous": <previous_page_url>,
        "next": <next_page_url>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/teamdownline/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>',
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/teamdownline/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld      | Description                            |
| ----------- | ---------------- | ---------- | -------------------------------------- |
| 400         | Validation Error | list\_type | Invalid list type. Please check again. |
| 400         | Validation Error | username   | Invalid username.                      |

## Customer Downline List

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/mycustomers/`

This API endpoint will return customer downline list.

#### Query Parameters

| Name       | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| list\_type | string | Possible values are "overall" and "month" |
| limit      | string |                                           |
| offset     | string |                                           |
| from\_date | string | format - MM/DD/YY                         |
| to\_date   | string | format - MM/DD/YY                         |
| username   | string | username                                  |

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "results": [
            {
                "uid_id": <uid>,
                "username": "<username>",
                "name": "<customer_name>",
                "role": [
                    {
                        "name": "<user_role>"
                    }
                ],
                "sale": "<sales>",
                "created": "<registerd_date>"
            },
        ],
        "count": <count_list>,
        "previous": <previous_page>,
        "next": <next_page>
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/mycustomers/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {

  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/mycustomers/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld      | Description                            |
| ----------- | ---------------- | ---------- | -------------------------------------- |
| 400         | Validation Error | list\_type | Invalid list type. Please check again. |
| 400         | Validation Error | username   | Invalid username.                      |

## Get Spilling Preference

<mark style="color:blue;">`GET`</mark> `‎https://<domain>/<api prefix>/<version>/user/get/spiling-preference/`

This API endpoint will return spilling preference choices, and user user selected choice.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {
        "choices": [
            [
                "<choice_key>",
                "<choice_short_name>",
                "<choice_description>",
                "<image_path>"
            ],
            ...
        ],
        "pref_value": "<user_current_choise_key>"
    }
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'GET',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/spiling-preference/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {}
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/spiling-preference/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

## Change Spilling Preference

<mark style="color:green;">`POST`</mark> `‎https://<domain>/<api prefix>/<version>/user/spiling-preference/`

This API endpoint will update user spilling preference choice.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| apikey<mark style="color:red;">\*</mark>        | string | apikey              |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer access token |

#### Request Body

| Name                                               | Type   | Description                 |
| -------------------------------------------------- | ------ | --------------------------- |
| spiliing\_prefer<mark style="color:red;">\*</mark> | string | Spilling prefer choice key. |

{% tabs %}
{% tab title="200 " %}

```markup
HTTP/1.1 200 OK
Content-Type: application/json

Body:
{
    "status_code": 200,
    "errors": {},
    "data": {}
}
```

{% endtab %}
{% endtabs %}

#### Sample Code

**Node**

```php
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://<domain>/<api prefix>/<version>/user/get/spiling-preference/',
  'headers': {
    'apikey': '<apikey>',
    'Authorization': 'Bearer <access token>'
  },
  formData: {
    'spiliing_prefer': '<choice_key>'
  }
};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});
```

**PHP**

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/spiling-preference/',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('spiliing_prefer' => '<choice_key>'),
  CURLOPT_HTTPHEADER => array(
    'apikey: <apikey>',
    'Authorization: Bearer <access token>'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

#### Error Responses

| Status Code | Error Type       | FIeld            | Description                     |
| ----------- | ---------------- | ---------------- | ------------------------------- |
| 400         | Validation Error | spiliing\_prefer | Invalid spiliing prefer choice. |
