> 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/client-api-reference/functions/businessbrixx/diamant-connector.md).

# Diamant Connector

### Get Method

The Method Retrieves the data specified with **dataType** (like Address, CostCenter and so on). The **searchParams** and **fieldMatch** JSON properties are valid for all methods, but the fields mentioned in it are depending on the datatype used. For example: **postcode** is a valid **searchParam** for addresses, but not for cost centers.

The Get method will return the data it fetched from Diamant, so you get an array of JSON objects. The fieldMatch prameter will tell the brixxbox to change field names, so that it is more useful in an brixxbox environment.

#### Example Usages Get

This will retrieve all addresses from diamant. Field names are the original diamand field names

```javascript
 let result = await brixxApi.businessBrixx({
     functionName:"Diamant",
     methodName: "Get",
     company: "9018",
     dataType: "Address",
 });
 console.log(result)
```

\
This will retrieve all addresses with Postcode 61118 from diamant and return the result. Only the fields "key" and "Name1" will be returned.

```javascript
 let result = await brixxApi.businessBrixx({
     functionName:"Diamant",
     methodName: "Get",
     dataType: "Address",
     searchParams:{
         postcode: "61118"
     },  
     usedFields:["key", "Name1"]

 });
 console.log(result)
```

### Write to Diamant

This code will write an address to Diamant

```javascript
let result = brixxApi.businessBrixx({
   functionName: "Diamant",
   methodName: "Save",
   dataType: "Address",
   fields: {
      key: "12345",
      addresstype: "F",
      name1: "John Doe",
      street: "Elmstreet 123",
      postcode: "12345",
      town: "Berlin",
   },
});
```

### ImportTable Method

This method allows you to retrieve the data and insert it into the database. Query parameters work the same and are optional but you must user fieldMatch to assign diamant names to brixxbox field names

#### Example Usages Import Insert

This will retrieve all addresses from diamant and insert it into the table **address** the table will be wiped right before the import.

```javascript
 let result = await brixxApi.businessBrixx({
     functionName:"Diamant",
     methodName: "ImportTable",
     dataType: "Address",
     tableName: "address",
     wipeTable: true,
     fieldMatch:{
         postcode: "adrZip",
         name1: "adrName"
     }, 
 });
 console.log(result)
```

#### Example Usages Import Upsert

This will retrieve all addresses from diamant and update the records with the same id as in fieldMatch.

```javascript
 let result = await brixxApi.businessBrixx({
     functionName:"Diamant",
     methodName: "ImportTable",
     dataType: "Address",
     tableName: "address",
     upsert: true,
     wipeTable: true,
     fieldMatch:{
         key: "adrKey,id",
         postcode: "adrZip",
         name1: "adrName"
     }, 
 });
 console.log(result)
```

### Supported dataTypes

More types can be added at request.

Request Data

* Address (Adressen)
* CostCenter (Kostenstellen)
* GenLedgAccount (Sachkonten)
* CostObject (Kostenträger)
* PrimCostElement (Primärkostenarten)
* Project (Projekte)
* Company (Mandanten)
* Customer(Konten)
* Vendor (Vendor)
* Posting (Buchungen)

Transctions

* [OpenStack](/brixxbox-documentation/client-api-reference/functions/businessbrixx/diamant-connector/diamant-openstack.md)
* [Transaction](/brixxbox-documentation/client-api-reference/functions/businessbrixx/diamant-connector/diamant-transaction.md)
* [CloseStack](/brixxbox-documentation/client-api-reference/functions/businessbrixx/diamant-connector/diamant-closestack.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://brixxbox.gitbook.io/brixxbox-documentation/client-api-reference/functions/businessbrixx/diamant-connector.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
