> For the complete documentation index, see [llms.txt](https://brixxbox.gitbook.io/brixxbox-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brixxbox.gitbook.io/brixxbox-documentation/server-api-reference.md).

# Server API Reference

### How to Use Server Side Functions

{% embed url="<https://youtu.be/HC1IH8ralxA>" %}

### Preparing to use BrixxServerApi &#x20;

Install from npm. This will give your project access to the BrixxServerApi.

```
npm i @brixxbox/brixx-server-api
```

Reference the Class BrixxServerApi from your function source.

```javascript
const BrixxServerApi = require('@brixxbox/brixx-server-api');
```

Create an instance from BrixxServerApi to access the avialable methods.

```javascript
//Note: the constructor will always get the 2. parameter from 
//the functions call as parameter. This parameter expects the brixxboxMeta 
//as part of the body content (req.body.brixxboxMeta) 
const brixxServerApi = new BrixxServerApi(req);
```

Now the different methods from brixxServerApi can be called.&#x20;

#### Example

```javascript

const BrixxServerApi = require('@brixxbox/brixx-server-api');

module.exports = async function (context, req) {
    const brixxServerApi = new BrixxServerApi(req);
    currencyRate = await brixxServerApi.businessBrixx({
        functionName:"CurrencyConverter",
        methodName: "Convert",
        fromCurrencySymbol: "EUR",
        toCurrencySymbol: "USD"
    });

    //result back to caller (if needed)
    context.res = {
        status: 200,
        body: { 
            responseMessage: 'Rate EUR/USD: ' + currencyRate,
            currencyRate: currencyRate
        }
    };
}
```

### Server Side Api Function List

* [loadConfigRecordById](/brixxbox-documentation/server-api-reference/functions/loadconfigrecordbyid.md)
* [saveConfigRecordById](/brixxbox-documentation/server-api-reference/functions/saveconfigrecordbyid.md)
* [sqlWrite](/brixxbox-documentation/server-api-reference/functions/sqlwrite.md)
* [sqlRead](/brixxbox-documentation/server-api-reference/functions/sqlread.md)
* [sendEmail](/brixxbox-documentation/server-api-reference/functions/sendemail.md)
* [createReportPdfBlob](/brixxbox-documentation/server-api-reference/functions/createreportpdfblob.md)
* [cloudPrint](/brixxbox-documentation/server-api-reference/functions/cloudprint.md)
* [businesssBrixx](/brixxbox-documentation/server-api-reference/functions/businessbrixx.md)

#### To invoke a server function from the a brixxApi client please check [serverFunction](/brixxbox-documentation/client-api-reference/functions/serverfunction.md)
