# Dashboard APIs

## Login Admin

<mark style="color:green;">`POST`</mark> `https://market-mfund-development.herokuapp.com/api/admin/authentication/login/`

This endpoint allows user to login and get JWT tokens from Node Server. Before making this request, firebase authentication must be made from admin app and Firebase JWT token is send in body for verification.

#### Request Body

| Name     | Type   | Description                      |
| -------- | ------ | -------------------------------- |
| password | string | Password of the respective admin |
| email    | string | Email Id of the admin            |

{% tabs %}
{% tab title="200 On Successful Login" %}

```
{
    "status": "success",
    "access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MzcsImVtYWlsIjoidmlyYWxzQGdlZWt5YW50cy5jb20iLCJpc0FkbWluIjp0cnVlLCJpYXQiOjE2MDg3MjAzNDQsImV4cCI6MTYwODgwNjc0NCwiYXVkIjoibWFya2V0LW1mdW5kLXVzZXJzIiwiaXNzIjoiZ2Vla3lhbnRzIn0.mxZ52tCdBPZyi567mkp68dwouI_hEjOMP40ym0nawmkrxp5mgdzMrD83as_inp5suqhopcoGVDhKZc3wEXTpmAkVHYownl19vqzqXLVe8tb8x_mWQrMtp_SNRifKYseanriLW6_LotXaQarfehZ-__-1GHGLbmWSbZjFmE6zUSvdJUxSiGtZd0K6CIKMZoBwQKTHCoYqRUAAyUlVue5Q4EZJFC8BU2NBKY_RrcvTlh9qRewwRiCfha4dZBbb22vbQNsON0OITLdvNIPsEavHYh54J8NvItFfuReNP9gJQkjSVbUZwImldQBbmTwEynMaR8bGDxboRQ14ktq-47mvIY0dYAUwiyDLjK_Tyg1EvswYDLOweUpW6KWWnTJh3xM2VhZPMkmeyjnYa_vUyuwNdc3uP28i9VEhr4uyTkCfzlCJJ_rZx-1h-lq1bNWNpDkW6ZItO0m_rD-OWP8svjqpuKjwc7S2xWsxMJlr6sfyBKQHPqMr7BDlWilp7PRLUBt_FXj-7_Fnk8Df9zBIC8oWvg-WwbMo6ES9zD6vt7fHag91fPuwFpALcwqp2N2qrrZGtTCowowYHgP6SmDo-P0Z_CCCyh3plZqB5e8eF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`https://market-mfund-development.herokuapp.com/api/admin/home/`

This Api will retrieve all the information displayed on the home page of admin app. This API requires JWT access token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description       |
| ------------- | ------ | ----------------- |
| Authorization | string | Bearer eyjhbg.... |

{% tabs %}
{% tab title="200 Will get the total number of investors and the total investment" %}

```
{
    "userCount": 6,
    "totalInvestments": 17000
}
```

{% endtab %}
{% endtabs %}

## Organisations API

<mark style="color:blue;">`GET`</mark> `https://market-mfund-development.herokuapp.com/api/admin/home/organisations`

This endpoint will retrieve all the information about organisations. This API requires JWT access token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer eyjhbg... |

{% tabs %}
{% tab title="200 Details of all the organisations" %}

```
[
    {
        "name": "Axis Bluechip Fund Direct Plan Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FAxis.png?alt=media&token=70443f42-43aa-463b-9762-a33aa25eb8aa",
        "xirr": "10%",
        "currentValue": 489,
        "returns": "123",
        "currentValueChange": "+0.54%",
        "returnsChange": "-0.54%",
        "rating": 3.5
    },
    {
        "name": "Reliance Small Cap Fund Direct Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FReliance.png?alt=media&token=432ad8b7-6825-42c4-affc-9943e813a7ef",
        "xirr": "20%",
        "currentValue": 758,
        "returns": "657",
        "currentValueChange": "+0.54%",
        "returnsChange": "-0.54%",
        "rating": 4
    },
    {
        "name": "Icici Prudential Bluechip Fund Direct Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2Ficici_logo.png?alt=media&token=762fe9a2-7308-413e-a956-d23b6bae9f03",
        "xirr": "15%",
        "currentValue": 882,
        "returns": "455",
        "currentValueChange": "+0.54%",
        "returnsChange": "-0.54%",
        "rating": 2.5
    },
    {
        "name": "Tesla",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FAxis.png?alt=media&token=70443f42-43aa-463b-9762-a33aa25eb8aa",
        "xirr": "12%",
        "currentValue": 2345,
        "returns": "456",
        "currentValueChange": "+0.54%",
        "returnsChange": "-0.54%",
        "rating": 3.5
    }
]
```

{% endtab %}
{% endtabs %}

## Add Organisation API

<mark style="color:green;">`POST`</mark> `https://market-mfund-development.herokuapp.com/api/admin/add_new_organisation`

This endpoint allows an admin to add organisations in the database.This API requires JWT token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description   |
| ------------- | ------ | ------------- |
| Authorization | string | Access Token. |

#### Request Body

| Name         | Type   | Description                          |
| ------------ | ------ | ------------------------------------ |
| returns      | string | returns of the organisation          |
| currentValue | string | current value of organisation        |
| xirr         | string | xirr of organisation                 |
| schemeName   | string | Name of the organisation to be added |

{% tabs %}
{% tab title="200 Successfully added an organisation." %}

```
{
    "status": "success"
}
```

{% endtab %}
{% endtabs %}

## Investors API

<mark style="color:blue;">`GET`</mark> `https://market-mfund-development.herokuapp.com/api/admin/investors`

This endpoint will retrieve the Investors details. This API requires JWT token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description   |
| ------------- | ------ | ------------- |
| Authorization | string | Access Token. |

{% tabs %}
{% tab title="200 Successfully retrieved Investors." %}

```
[
    {
        "userFullName": "Testing",
        "schemeName": "Axis Bluechip Fund Direct Plan Growth",
        "currentValue": "$489",
        "returns": "$4405.56",
        "currentValueRate": "+0.54%",
        "returnsRate": "-0.54%",
        "duration": "365 Days",
        "status": "Running"
    },
    {
        "userFullName": "Madhav Bansal",
        "schemeName": "Axis Bluechip Fund Direct Plan Growth",
        "currentValue": "$489",
        "returns": "$4405.56",
        "currentValueRate": "+0.54%",
        "returnsRate": "-0.54%",
        "duration": "1095 Days",
        "status": "Running"
    },
    {
        "userFullName": "Devanshi Garg",
        "schemeName": "Reliance Small Cap Fund Direct Growth",
        "currentValue": "$758",
        "returns": "$4405.56",
        "currentValueRate": "+0.54%",
        "returnsRate": "-0.54%",
        "duration": "1095 Days",
        "status": "Running"
    },
    {
        "userFullName": "Devanshi Garg",
        "schemeName": "Reliance Small Cap Fund Direct Growth",
        "currentValue": "$758",
        "returns": "$4405.56",
        "currentValueRate": "+0.54%",
        "returnsRate": "-0.54%",
        "duration": "1825 Days",
        "status": "Running"
    }
]
```

{% endtab %}
{% endtabs %}

## Balances API

<mark style="color:blue;">`GET`</mark> `https://market-mfund-development.herokuapp.com/api/admin/balances`

This endpoint will retrieve all the balances of the organisations. This API requires JWT token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description   |
| ------------- | ------ | ------------- |
| Authorization | string | Access Token. |

{% tabs %}
{% tab title="200 Successfully retrieved all the balance amount." %}

```
[
    {
        "schemeName": "Axis Bluechip Fund Direct Plan Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FAxis.png?alt=media&token=70443f42-43aa-463b-9762-a33aa25eb8aa",
        "amount": "$6000"
    },
    {
        "schemeName": "Reliance Small Cap Fund Direct Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FReliance.png?alt=media&token=432ad8b7-6825-42c4-affc-9943e813a7ef",
        "amount": "$11000"
    },
    {
        "schemeName": "Icici Prudential Bluechip Fund Direct Growth",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2Ficici_logo.png?alt=media&token=762fe9a2-7308-413e-a956-d23b6bae9f03",
        "amount": "$0"
    },
    {
        "schemeName": "Tesla",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FAxis.png?alt=media&token=70443f42-43aa-463b-9762-a33aa25eb8aa",
        "amount": "$0"
    },
    {
        "schemeName": "Amazon",
        "image": "https://firebasestorage.googleapis.com/v0/b/market-mfund-development.appspot.com/o/Organization-logo-image%2FAxis.png?alt=media&token=70443f42-43aa-463b-9762-a33aa25eb8aa",
        "amount": "$0"
    }
]
```

{% endtab %}
{% endtabs %}

## Transactions API

<mark style="color:blue;">`GET`</mark> `https://market-mfund-development.herokuapp.com/api/admin/transaction_details`

This endpoint will retrieve the transaction details made by a specific user. This API requires JWT token which is retrieved from Login API.

#### Path Parameters

| Name          | Type   | Description   |
| ------------- | ------ | ------------- |
| Authorization | string | Access Token. |

{% tabs %}
{% tab title="200 Successfully retrieved Transactions." %}

```
[
    {
        "userFullName": "Testing",
        "schemeName": "Axis Bluechip Fund Direct Plan Growth",
        "amount": "1000",
        "paymentMode": "net_banking",
        "dateOfInvestments": "365 Days",
        "status": "3 Dec 2020 3:53 AM"
    },
    {
        "userFullName": "Madhav Bansal",
        "schemeName": "Axis Bluechip Fund Direct Plan Growth",
        "amount": "5000",
        "paymentMode": "Debit card",
        "dateOfInvestments": "1095 Days",
        "status": "7 Dec 2020 5:42 AM"
    },
    {
        "userFullName": "Devanshi Garg",
        "schemeName": "Reliance Small Cap Fund Direct Growth",
        "amount": "10000",
        "paymentMode": "DebitCard",
        "dateOfInvestments": "1095 Days",
        "status": "30 Nov 2020 6:27 AM"
    },
    {
        "userFullName": "Devanshi Garg",
        "schemeName": "Reliance Small Cap Fund Direct Growth",
        "amount": "1000",
        "paymentMode": "DebitCard",
        "dateOfInvestments": "1825 Days",
        "status": "30 Nov 2020 6:42 AM"
    }
]
```

{% endtab %}
{% endtabs %}

## Add Admin

<mark style="color:green;">`POST`</mark> `https://market-mfund-development.herokuapp.com/api/admin/authentication/add_admin/`

This endpoint allows to create an admin in the postgreSQL database . This API requires JWT access token which is retrieved from Login Admin API.

#### Headers

| Name          | Type   | Description        |
| ------------- | ------ | ------------------ |
| Authorization | string | Bearer eyjhbg..... |

#### Request Body

| Name     | Type   | Description                                         |
| -------- | ------ | --------------------------------------------------- |
| password | string | Password to be associated with the respective admin |
| email    | string | Email Id to be registered                           |

{% tabs %}
{% tab title="200 Admin has been created successfully." %}

```
{
    "status": "success"
}
```

{% endtab %}
{% endtabs %}

## Change Password

<mark style="color:green;">`POST`</mark> `https://market-mfund-development.herokuapp.com/api/admin/change_password`

This endpoint allows admin to change his/her current password. This API requires JWT access token which is retrieved from Login Admin API.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer ejhyzn... |

#### Request Body

| Name        | Type   | Description               |
| ----------- | ------ | ------------------------- |
| newPassword | string | New Password for admin    |
| oldPassword | string | Current password of admin |

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

```
{
    "status": "success"
}
```

{% endtab %}
{% endtabs %}

## Notification API

<mark style="color:blue;">`GET`</mark> `https://market-mfund-development.herokuapp.com/api/admin/notifications`

This endpoint will retrieve all the Notifications. This API requires JWT access token which is retrieved from Login API.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer eyjhbg... |

{% tabs %}
{% tab title="200 All the notifications of a specific admin." %}

```
[
    {
        "id": 25,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:06 AM"
    },
    {
        "id": 26,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:08 AM"
    },
    {
        "id": 27,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:10 AM"
    },
    {
        "id": 28,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:13 AM"
    },
    {
        "id": 29,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:16 AM"
    },
    {
        "id": 30,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:33 AM"
    },
    {
        "id": 31,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:38 AM"
    },
    {
        "id": 32,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 12:40 AM"
    },
    {
        "id": 33,
        "title": "New organisation created",
        "description": "New organisation has been successfully created.",
        "badge": "New organisation",
        "createdAt": "22 Dec 2020 1:04 PM"
    },
    {
        "id": 34,
        "title": "New admin created",
        "description": "New admin has been successfully created.",
        "badge": "New admin",
        "createdAt": "23 Dec 2020 12:17 AM"
    }
]
```

{% endtab %}
{% endtabs %}

## Notifications API

<mark style="color:red;">`DELETE`</mark> `https://market-mfund-development.herokuapp.com/api/admin/notifications`

This endpoint will delete all the notifications associated with a specific admin.

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer eyjhbg... |

{% tabs %}
{% tab title="200 Success as all notifications are deleted." %}

```
{
    "status": "success"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devanshixaviers.gitbook.io/mfund-documentation/api-documentation-1/dashboard-apis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
