# Integration Specifications

## Integration Overview

Newstore is an omnichannel platform that provides retail businesses with mobile POS and integrated cloud-based order management systems.

This document provides context on what kind of data is being gathered through this extractor, which endpoints that data is coming from, and how the extracted tables relate to each other.

## **Integration Availability**

This integration is available for:

* Enterprise

## API Endpoints

The Daasity Newstore extractor is built based on this [Newstore API documentation](https://docs.newstore.net/api/). The following endpoint is used by Daasity to replicate data from Newstore:

* [Customer Profile Updates](https://docs.newstore.net/api/integration/consumer_profile_api#operation/List%20full%20customers)
* [Inventory Manager](https://docs.newstore.net/api/integration/inventory-management/inventory_manager_api_bff#operation/updateReceivingTransaction)
* [Item Return](https://docs.newstore.net/api/integration/order-management/item_return_api)
* [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* [Stock Locations](https://docs.newstore.net/api/integration/inventory-management/stock_locations_api)

## Entity Relationship Diagram (ERD)

[Click here to view the ERD for the Daasity Newstore](https://lucid.app/documents/embedded/a836981d-b9b6-4ae7-9b0d-284b0e47afb4) integration illustrating the different tables and keys to join across tables.

## Newstore Schema

The Daasity Newstore extractor creates these tables using the endpoints and replication methods listed.  The data is mapped from source API endpoint to the table based on the mapping logic outlined in each table.​

* [Customers](#customers)
* [Customer Address Table](#customer-address-table)
* [Customers Extended Attributes](#customer-extended-attributes)
* [Order Events](#order-events)
* [Order Extended Attributes](#order-extended-attributes)
* [Order Item Events](#order-item-events)
* [Order Item Extended Attributes](#order-item-extended-attributes)
* [Order Item Extended Identifiers](#order-item-external-identifiers)
* [Returns](#returns)
* [Return Items](#return-items)
* [Inventory Count](#inventory-count)
* [Inventory Count Items](#inventory-count-items)
* [Inventory Count Items External Identifiers](#inventory-count-item-external-identifiers)

### **Customers**

* Endpoint: [Customer Profile Updates](https://docs.newstore.net/api/integration/consumer_profile_api#operation/List%20full%20customers)
* Update Method: UPSERT
* Table Name: \[`newstore.customers`]

| JSON Element                                                                       | Database Column  |
| ---------------------------------------------------------------------------------- | ---------------- |
| tenant                                                                             | tenant           |
| name                                                                               | name             |
| published\_at                                                                      | published\_at    |
| payload::id                                                                        | id               |
| payload::email                                                                     | email            |
| payload::first\_name                                                               | first\_name      |
| payload::last\_name                                                                | last\_name       |
| payload::phone                                                                     | phone            |
| payload::source::location\_id                                                      | location\_id     |
| payload::source::associate\_id                                                     | associate\_id    |
| payload::source::associate\_name                                                   | associate\_name  |
| payload::source::associate\_email                                                  | associate\_email |
| payload::created\_at                                                               | created\_at      |
| payload::updated\_at                                                               | updated\_at      |
| payload::revision                                                                  | revision         |
| environment                                                                        | environment      |
| account\_id                                                                        | \_account\_id    |
| MD5(payload::id + payload::created\_at + payload::updated\_at + payload::revision) | \_\_sync\_key    |
| Daasity: timestamp when loaded into DB                                             | \_\_synced\_at   |

### **Customer Address Table**

* Endpoint: [Customer Profile Updates](https://docs.newstore.net/api/integration/consumer_profile_api#operation/List%20full%20customers)
* Update Method: UPSERT
* Table Name: \[`newstore.customer_address_table`]

| JSON Element                                                                                                                       | Database Column  |
| ---------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| tenant                                                                                                                             | tenant           |
| name                                                                                                                               | name             |
| published\_at                                                                                                                      | published\_at    |
| payload::id                                                                                                                        | id               |
| payload::customer\_id                                                                                                              | customer\_id     |
| payload::type                                                                                                                      | type             |
| payload::salutation                                                                                                                | salutation       |
| payload::title                                                                                                                     | title            |
| payload::first\_name                                                                                                               | first\_name      |
| payload::last\_name                                                                                                                | last\_name       |
| payload::suffix                                                                                                                    | suffix           |
| payload::company                                                                                                                   | company          |
| payload::address\_line\_1                                                                                                          | address\_line\_1 |
| payload::address\_line\_2                                                                                                          | address\_line\_2 |
| payload::address\_line1                                                                                                            | address\_line1   |
| payload::address\_line2                                                                                                            | address\_line2   |
| payload::zip\_code                                                                                                                 | zip\_code        |
| payload::city                                                                                                                      | city             |
| payload::state                                                                                                                     | state            |
| payload::country                                                                                                                   | country          |
| payload::phone                                                                                                                     | phone            |
| payload::created\_at                                                                                                               | created\_at      |
| payload::updated\_at                                                                                                               | updated\_at      |
| payload::customer\_revision                                                                                                        | revision         |
| environment                                                                                                                        | environment      |
| account\_id                                                                                                                        | \_account\_id    |
| MD5(environment + payload::id + payload::customer\_id + payload::created\_at + payload::updated\_at + payload::customer\_revision) | \_\_sync\_key    |
| Daasity: timestamp when loaded into DB                                                                                             | \_\_synced\_at   |

### **Customer Extended Attributes**

* Endpoint: [Customer Profile Updates](https://docs.newstore.net/api/integration/consumer_profile_api#operation/List%20full%20customers)
* Update Method: UPSERT
* Table Name: \[`newstore.customer_extended_attributes`]

| JSON Element                                                                                                                       | Database Column     |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------- |
| customer::id                                                                                                                       | customer\_id        |
| customer::extended\_attributes::name                                                                                               | extended\_attribute |
| customer::extended\_attributes::value                                                                                              | value               |
| customer::revision                                                                                                                 | revision            |
| environment                                                                                                                        | environment         |
| account\_id                                                                                                                        | \_account\_id       |
| MD5(environment + customer::id + customer::extended\_attributes:name + customer::extended\_attributes::value + customer::revision) | \_\_sync\_key       |
| Daasity: timestamp when loaded into DB                                                                                             | \_\_synced\_at      |

### **Order Events**

* Endpoint: [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* Update Method: UPSERT
* Table Name: \[`newstore.order_events`]

| JSON Element                                                                         | Database Column       |
| ------------------------------------------------------------------------------------ | --------------------- |
| payload::id                                                                          | order\_id             |
| payload::external\_id                                                                | external\_id          |
| payload::customer\_email                                                             | customer\_email       |
| payload::customer\_id                                                                | customer\_id          |
| status::name                                                                         | status                |
| published\_at                                                                        | published\_at         |
| payload::created\_at                                                                 | order\_date           |
| payload::subtotal                                                                    | subtotal              |
| payload::price\_method                                                               | price\_method         |
| payload::discount\_total                                                             | discount\_total       |
| payload::shipping\_total                                                             | shipping\_total       |
| payload::shipping\_tax                                                               | shipping\_tax         |
| payload::tax\_total                                                                  | tax\_total            |
| payload::grand\_total                                                                | grand\_total          |
| payload::currency                                                                    | currency              |
| shipping::first\_name                                                                | shipping\_first\_name |
| shipping::last\_name                                                                 | shipping\_last\_name  |
| shipping::address\_line1                                                             | shipping\_address1    |
| shipping::address\_line2                                                             | shipping\_address2    |
| shipping::city                                                                       | shipping\_city        |
| shipping::state                                                                      | shipping\_state       |
| shipping::country                                                                    | shipping\_country     |
| shipping::zip\_code                                                                  | shipping\_zipcode     |
| shipping::phone                                                                      | shipping\_phone       |
| billing::first\_name                                                                 | billing\_first\_name  |
| billing::last\_name                                                                  | billing\_last\_name   |
| billing::address1                                                                    | billing\_address1     |
| billing::address2                                                                    | billing\_address2     |
| billing::city                                                                        | billing\_city         |
| billing::state                                                                       | billing\_state        |
| billing::country                                                                     | billing\_country      |
| billing::zip\_code                                                                   | billing\_zipcode      |
| billing::phone                                                                       | billing\_phone        |
| payload::channel\_type                                                               | channel\_type         |
| payload::channel\_id                                                                 | channel\_id           |
| payload::associate\_id                                                               | associate\_id         |
| payload::associate\_email                                                            | associate\_email      |
| payload::is\_exchange                                                                | is\_exchange          |
| payload::is\_historical                                                              | is\_historical        |
| payload::is\_tax\_exempt                                                             | is\_tax\_exempt       |
| name                                                                                 | event\_name           |
| cancellation\_reason                                                                 | cancellation\_reason  |
| payload::created\_at \|\| payload::published\_at                                     | created\_at           |
| environment                                                                          | environment           |
| source\_id                                                                           | source\_id            |
| MD5(environment + payload::id + source\_id + payload::published\_at + payload::name) | \_\_sync\_key         |
| Daasity: timestamp when loaded into DB                                               | \_\_synced\_at        |

### **Order Extended Attributes**

* Endpoint: [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* Update Method: UPSERT
* Table Name: \[`newstore.order_extended_attributes`]

| JSON Element                                                                           | Database Column |
| -------------------------------------------------------------------------------------- | --------------- |
| order::extended\_attributes::id                                                        | order\_id       |
| order::extended\_attributes::name                                                      | name            |
| order::extended\_attributes::value                                                     | value           |
| environment                                                                            | environment     |
| MD5(environment + order::extended\_attributes::id + order::extended\_attributes::name) | \_\_sync\_key   |
| Daasity: timestamp when loaded into DB                                                 | \_\_synced\_at  |

### **Order Item Events**

* Endpoint: [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* Update Method: UPSERT
* Table Name: \[`newstore.order_item_events`]

| JSON Element                                                                                   | Database Column           |
| ---------------------------------------------------------------------------------------------- | ------------------------- |
| payload::id                                                                                    | order\_id                 |
| item::id                                                                                       | order\_item\_id           |
| item::product\_id                                                                              | product\_id               |
| item::item\_type                                                                               | item\_type                |
| item::list\_price                                                                              | list\_price               |
| item::item\_discounts                                                                          | item\_discounts           |
| item::order\_discounts                                                                         | order\_discounts          |
| item::pricebook\_id                                                                            | pricebook\_id             |
| item::pricebook\_price                                                                         | pricebook\_price          |
| item::shipping\_service\_level                                                                 | shipping\_service\_level  |
| item::tax                                                                                      | tax                       |
| item::tax\_class                                                                               | tax\_class                |
| item::quantity                                                                                 | quantity                  |
| item::fulfillment\_location\_id                                                                | fulfillment\_location\_id |
| item::status                                                                                   | status                    |
| item::cancelled\_reason                                                                        | cancelled\_reason         |
| environment                                                                                    | environment               |
| source\_id                                                                                     | \_\_source\_id            |
| MD5(environment + source\_id + payload::id + item::id + payload::published\_at + item::status) | \_\_sync\_key             |
| published\_at                                                                                  | \_\_synced\_at            |

### **Order Item Extended Attributes**

* Endpoint: [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* Update Method: UPSERT
* Table Name: \[`newstore.order_item_extended_attributes`]

| JSON Element                                                                                           | Database Column |
| ------------------------------------------------------------------------------------------------------ | --------------- |
| item::extended\_attributes::order\_id                                                                  | order\_id       |
| item::id                                                                                               | order\_item\_id |
| item::extended\_attributes::name                                                                       | name            |
| item::extended\_attributes::value                                                                      | value           |
| environment                                                                                            | environment     |
| MD5(environment + item::extended\_attributes::order\_id + item::id + item::extended\_attributes::name) | \_\_sync\_key   |
| Daasity: timestamp when loaded into DB                                                                 | \_\_synced\_at  |

### **Order Item External Identifiers**

* Endpoint: [Order](https://docs.newstore.net/api/integration/order-management/sales_order_api#tag/Orders-by-ID-and-type/operation/get-sales-order-by-id-and-id-type)
* Update Method: UPSERT
* Table Name: \[`newstore.order_item_external_identifiers`]

| JSON Element                                                                              | Database Column |
| ----------------------------------------------------------------------------------------- | --------------- |
| content::payload + content::id                                                            | order\_id       |
| item::external\_identifiers::id                                                           | order\_item\_id |
| 'k'                                                                                       | name            |
| 'v'                                                                                       | value           |
| environment                                                                               | environment     |
| MD5(environmnet + content::payload + content::id + item::external\_identifiers::id + 'k') | \_\_sync\_key   |
| Daasity: timestamp when loaded into DB                                                    | \_\_synced\_at  |

### **Returns**

* Endpoint: [Item Return](https://docs.newstore.net/api/integration/order-management/item_return_api)
* Update Method: UPSERT
* Table Name: \[`newstore.returns`]

| JSON Element                                                                                                                                                                                                             | Database Column                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------- |
| tenant                                                                                                                                                                                                                   | tenant                          |
| name                                                                                                                                                                                                                     | name                            |
| published\_at                                                                                                                                                                                                            | published\_at                   |
| payload::id                                                                                                                                                                                                              | id                              |
| payload::order\_id                                                                                                                                                                                                       | order\_id                       |
| payload::returned\_at                                                                                                                                                                                                    | returned\_at                    |
| payload::total\_refund\_amount                                                                                                                                                                                           | total\_refund\_amount           |
| payload::total\_refund\_amount\_adjusted                                                                                                                                                                                 | total\_refund\_amount\_adjusted |
| payload::total\_refund\_excl\_tax                                                                                                                                                                                        | total\_refund\_excl\_tax        |
| payload::return\_fee                                                                                                                                                                                                     | return\_fee                     |
| payload::currency                                                                                                                                                                                                        | currency                        |
| payload::returnlocation\_id                                                                                                                                                                                              | return\_location\_id            |
| payload::customer\_id                                                                                                                                                                                                    | customer\_id                    |
| payload::customer\_email                                                                                                                                                                                                 | customer\_email                 |
| payload::associate\_id                                                                                                                                                                                                   | associate\_id                   |
| payload::associate\_email                                                                                                                                                                                                | associate\_email                |
| environment                                                                                                                                                                                                              | environment                     |
| account\_id                                                                                                                                                                                                              | \_account\_id                   |
| MD5(environment + payload::id +payload::order\_id + payload::returned\_at + payload::total\_refund\_amount + payload::total\_refund\_amount\_adjusted + payload::total\_refund\_excl\_tax + payload::total\_refund\_tax) | \_\_sync\_key                   |
| Daasity: timestamp when loaded into DB                                                                                                                                                                                   | \_\_synced\_at                  |

### **Return Items**

* Endpoint: [Item Return](https://docs.newstore.net/api/integration/order-management/item_return_api)
* Update Method: UPSERT
* Table Name: \[`newstore.return_items`]

| JSON Element                                                  | Database Column          |
| ------------------------------------------------------------- | ------------------------ |
| payload::id                                                   | return\_id               |
| item::id                                                      | id                       |
| item::product\_id                                             | product\_id              |
| item::item\_type                                              | item\_type               |
| item::item\_condition                                         | item\_condition          |
| item::condition\_code                                         | condition\_code          |
| item::return\_Reason                                          | return\_Reason           |
| item::return\_code                                            | return\_code             |
| item::refund\_excl\_tax                                       | refund\_excl\_tax        |
| item::refund\_tax                                             | refund\_tax              |
| item::refund\_amount                                          | refund\_amount           |
| item::refund\_amount\_adjusted                                | refund\_amount\_adjusted |
| item::quantity                                                | quantity                 |
| environment                                                   | environment              |
| account\_id                                                   | \_account\_id            |
| MD5(environment + payload::id + item::id + item::product\_id) | \_\_sync\_key            |
| Daasity: timestamp when loaded into DB                        | \_\_synced\_at           |

### **Inventory Count**

* Endpoint: Inventory Manager
* Update Method: UPSERT
* Table Name: \[`newstore.inventory_count`]

| JSON Element                                                                                                                                                                                                                                        | Database Column           |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| tenant                                                                                                                                                                                                                                              | tenant                    |
| name                                                                                                                                                                                                                                                | name                      |
| published\_at                                                                                                                                                                                                                                       | published\_at             |
| payload::id                                                                                                                                                                                                                                         | id                        |
| payload::count\_type                                                                                                                                                                                                                                | count\_type               |
| payload::fulfillment\_location\_id                                                                                                                                                                                                                  | fulfillment\_location\_id |
| payload::associate\_id                                                                                                                                                                                                                              | associate\_id             |
| payload::stock\_location\_name                                                                                                                                                                                                                      | stock\_location\_name     |
| payload::due\_date                                                                                                                                                                                                                                  | due\_date                 |
| payload::started\_at                                                                                                                                                                                                                                | started\_at               |
| payload::completed\_at                                                                                                                                                                                                                              | completed\_at             |
| payload::chunk\_number                                                                                                                                                                                                                              | chunk\_number             |
| payload::total\_chunks                                                                                                                                                                                                                              | total\_chunks             |
| environment                                                                                                                                                                                                                                         | environment               |
| account\_id                                                                                                                                                                                                                                         | \_account\_id             |
| MD5(published\_at + payload::id + payload::count\_type + payload::fulfillment\_location\_id + payload::associate\_id + payload::stock\_location\_name + payload::due\_date + payload::started\_at + payload::complete\_at + payload::chunk\_number) | \_\_sync\_key             |
| Daasity: timestamp when loaded into DB                                                                                                                                                                                                              | \_\_synced\_at            |

### **Inventory Count Items**

* Endpoint: Stock Locations
* Update Method: UPSERT
* Table Name: \[`newstore.inventory_count_items`]

| JSON Element                                                               | Database Column |
| -------------------------------------------------------------------------- | --------------- |
| inventory\_id                                                              | inventory\_id   |
| item::product\_id                                                          | product\_id     |
| item::stock\_on\_hand                                                      | stock\_on\_hand |
| item::count                                                                | count           |
| environment                                                                | environment     |
| account\_id                                                                | \_account\_id   |
| MD5(environment + item::product\_id + item::stock\_on\_hand + item::count) | \_\_sync\_key   |
| Daasity: timestamp when loaded into DB                                     | \_\_synced\_at  |

### **Inventory Count Item External Identifiers**

* Endpoint: Stock Locations
* Update Method: UPSERT
* Table Name: \[`newstore.inventory_count_items_external_identifiers`]

| JSON Element                                                 | Database Column      |
| ------------------------------------------------------------ | -------------------- |
| inventory\_id                                                | inventory\_id        |
| item::product\_id                                            | product\_id          |
| 'k'                                                          | external\_identifier |
| 'v'                                                          | value                |
| environment                                                  | environment          |
| account\_id                                                  | \_account\_id        |
| MD5(environment + inventory\_id + item::product\_id + k + v) | \_\_sync\_key        |
| Daasity: timestamp when loaded into DB                       | \_\_synced\_at       |


---

# 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://help.daasity.com/core-concepts/data-integrations/setup-guides/digital-integrations/newstore/integration-specifications.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.
