# Integration Specifications

### Integration Overview

Target Unified+ (also called Target Plus) is Target's marketplace platform that allows third-party sellers to list and sell products on Target.com. The Daasity integration provides data on orders, products, customers, inventory, and financial transactions from the Target Plus API.

#### Integration Availability

This integration is available for:

* Enterprise

#### API Endpoints

This extractor is based on the [Target Plus API Documentation](https://developer.target.com). The following endpoints are used to replicate data into Daasity:

* [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders`
* [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog`
* [Order Addresses](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/order_addresses`
* [Product Returns](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/product_returns`
* [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers`
* [Order Fulfillments](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders/{order-id}/fulfillments`
* [Shipping Methods](https://developer.target.com) - `GET /seller_orders/v1/shipping_methods`

#### Entity Relationship Diagram (ERD)

[Click here to view the ERD for the Daasity Target Unified Plus integration](https://dbdiagram.io/d/TARGET_UNIFIED_PLUS_ERD-dbml-6944dc444bbde0fd74c7006d) illustrating the different tables and keys to join across tables.

#### Target Unified+ Schema

The Target Unified+ 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.

* [Orders](#orders)
* [Order Lines](#order-lines)
* [Order Line Discounts](#order-line-discounts)
* [Order Line Other Infos](#order-line-other-infos)
* [Order Line Statuses](#order-line-statuses)
* [Order Addresses](#order-addresses)
* [Order Address Phone Numbers](#order-address-phone-numbers)
* [Products Catalog](#products-catalog)
* [Product Catalog Quantities](#product-catalog-quantities)
* [Product Catalog Statuses](#product-catalog-statuses)
* [Product Catalog Status Errors](#product-catalog-status-errors)
* [Product Catalog Fields](#product-catalog-fields)
* [Product Details](#product-details)
* [Product Detail Merch Type Attributes](#product-detail-merch-type-attributes)
* [Product Returns](#product-returns)
* [Product Return Tracking Data](#product-return-tracking-data)
* [Distribution Centers](#distribution-centers)
* [Distribution Center Days of Operation Working Hours](#distribution-center-days-of-operation-working-hours)
* [Distribution Center Days of Operation Days Closed](#distribution-center-days-of-operation-days-closed)
* [Distribution Center Ship Nodes](#distribution-center-ship-nodes)
* [Distribution Center Ship Node Carriers](#distribution-center-ship-node-carriers)
* [Distribution Center Ship Node Service Levels](#distribution-center-ship-node-service-levels)
* [Order Fulfillments](#order-fulfillments)
* [Shipping Methods](#shipping-methods)

### **Orders**

**Endpoint:** [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders`

**Update Method:** UPSERT

**Table Name:** `target_plus.orders`

| JSON Element                | Column                    |
| --------------------------- | ------------------------- |
| `$.id`                      | `order_id`                |
| `$.order_number`            | `order_number`            |
| `$.ship_advice_number`      | `ship_advice_number`      |
| `$.vmm_vendor_id`           | `vmm_vendor_id`           |
| `$.seller_id`               | `seller_id`               |
| `$.distribution_center_id`  | `distribution_center_id`  |
| `$.ship_node_id`            | `ship_node_id`            |
| `$.order_date`              | `order_date`              |
| `$.requested_shipment_date` | `requested_shipment_date` |
| `$.requested_delivery_date` | `requested_delivery_date` |
| `$.order_status`            | `order_status`            |
| `$.currency`                | `currency`                |
| `$.created`                 | `created`                 |
| `$.created_by`              | `created_by`              |
| `$.last_modified`           | `last_modified`           |
| `$.last_modified_by`        | `last_modified_by`        |

### **Order Lines**

**Endpoint:** [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders` (nested in orders response)

**Update Method:** UPSERT

**Table Name:** `target_plus.order_lines`

| JSON Element                              | Column                    |
| ----------------------------------------- | ------------------------- |
| `$.order_lines[].order_line_number`       | `order_line_number`       |
| `$.id`                                    | `order_id`                |
| `$.order_lines[].tcin`                    | `tcin`                    |
| `$.order_lines[].unit_price`              | `unit_price`              |
| `$.order_lines[].quantity`                | `quantity`                |
| `$.order_lines[].routing`                 | `routing`                 |
| `$.order_lines[].total_shipping_price`    | `total_shipping_price`    |
| `$.order_lines[].total_handling_price`    | `total_handling_price`    |
| `$.order_lines[].total_price`             | `total_price`             |
| `$.order_lines[].other_fees`              | `other_fees`              |
| `$.order_lines[].total_item_discount`     | `total_item_discount`     |
| `$.order_lines[].total_shipping_discount` | `total_shipping_discount` |
| `$.order_lines[].total_gift_option_price` | `total_gift_option_price` |
| `$.order_lines[].is_two_day_ship`         | `is_two_day_ship`         |
| `$.order_lines[].external_id`             | `external_id`             |
| `$.order_lines[].is_registry_item`        | `is_registry_item`        |

### **Order Line Discounts**

**Endpoint:** [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders` (nested in orders response)

**Update Method:** UPSERT

**Table Name:** `target_plus.order_line_discounts`

| JSON Element                                  | Column              |
| --------------------------------------------- | ------------------- |
| `$.id`                                        | `order_id`          |
| `$.order_lines[].order_line_number`           | `order_line_number` |
| `$.order_lines[].discounts[].promotion_id`    | `promotion_id`      |
| `$.order_lines[].discounts[].description`     | `description`       |
| `$.order_lines[].discounts[].promotion_text`  | `promotion_text`    |
| `$.order_lines[].discounts[].discount_amount` | `discount_amount`   |

### **Order Line Other Infos**

**Endpoint:** [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders` (nested in orders response)

**Update Method:** UPSERT

**Table Name:** `target_plus.order_line_other_infos`

| JSON Element                         | Column              |
| ------------------------------------ | ------------------- |
| `$.id`                               | `order_id`          |
| `$.order_lines[].order_line_number`  | `order_line_number` |
| `$.order_lines[].other_info[].name`  | `name`              |
| `$.order_lines[].other_info[].value` | `value`             |

### **Order Line Statuses**

**Endpoint:** [Orders](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders` (nested in orders response)

**Update Method:** UPSERT

**Table Name:** `target_plus.order_line_statuses`

| JSON Element                                     | Column              |
| ------------------------------------------------ | ------------------- |
| `$.id`                                           | `order_id`          |
| `$.order_lines[].order_line_number`              | `order_line_number` |
| `$.order_lines[].order_line_statuses[].status`   | `status`            |
| `$.order_lines[].order_line_statuses[].quantity` | `quantity`          |

### **Order Addresses**

**Endpoint:** [Order Addresses](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/order_addresses`

**Update Method:** UPSERT

**Table Name:** `target_plus.order_addresses`

| JSON Element                      | Column                          |
| --------------------------------- | ------------------------------- |
| `$.id`                            | `order_address_id`              |
| `$.shipping_address.first_name`   | `shipping_address_first_name`   |
| `$.shipping_address.last_name`    | `shipping_address_last_name`    |
| `$.shipping_address.email`        | `shipping_address_email`        |
| `$.shipping_address.address1`     | `shipping_address_address1`     |
| `$.shipping_address.city`         | `shipping_address_city`         |
| `$.shipping_address.state`        | `shipping_address_state`        |
| `$.shipping_address.postal_code`  | `shipping_address_postal_code`  |
| `$.shipping_address.country_code` | `shipping_address_country_code` |

### **Order Address Phone Numbers**

**Endpoint:** [Order Addresses](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/order_addresses` (nested in order addresses response)

**Update Method:** UPSERT

**Table Name:** `target_plus.order_address_phone_numbers`

| JSON Element                                | Column             |
| ------------------------------------------- | ------------------ |
| `$.id`                                      | `order_address_id` |
| `$.shipping_address.phone_numbers[].number` | `number`           |
| `$.shipping_address.phone_numbers[].type`   | `type`             |

### **Products Catalog**

**Endpoint:** [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog`

**Update Method:** UPSERT

**Table Name:** `target_plus.products_catalog`

| JSON Element            | Column                |
| ----------------------- | --------------------- |
| `$.id`                  | `product_catalog_id`  |
| `$.external_id`         | `external_id`         |
| `$.relationship_type`   | `relationship_type`   |
| `$.seller_id`           | `seller_id`           |
| `$.tcin`                | `tcin`                |
| `$.item_type_id`        | `item_type_id`        |
| `$.created`             | `created`             |
| `$.created_by`          | `created_by`          |
| `$.last_modified`       | `last_modified`       |
| `$.last_modified_by`    | `last_modified_by`    |
| `$.previously_approved` | `previously_approved` |
| `$.parent_id`           | `parent_id`           |
| `$.price.list_price`    | `price_list_price`    |
| `$.price.offer_price`   | `price_offer_price`   |
| `$.price.map_price`     | `price_map_price`     |
| `$.price.last_modified` | `price_last_modified` |

### **Product Catalog Quantities**

**Endpoint:** [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog` (nested in products catalog response)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_catalog_quantities`

| JSON Element                            | Column                   |
| --------------------------------------- | ------------------------ |
| `$.id`                                  | `product_catalog_id`     |
| `$.quantities[].quantity`               | `quantity`               |
| `$.quantities[].distribution_center_id` | `distribution_center_id` |
| `$.quantities[].last_modified`          | `last_modified`          |
| `$.quantities[].last_modified_by`       | `last_modified_by`       |
| `$.quantities[].created`                | `created`                |
| `$.quantities[].created_by`             | `created_by`             |

### **Product Catalog Statuses**

**Endpoint:** [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog` (nested in products catalog response)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_catalog_statuses`

| JSON Element                             | Column               |
| ---------------------------------------- | -------------------- |
| `$.id`                                   | `product_catalog_id` |
| `$.product_statuses[].id`                | `status_id`          |
| `$.product_statuses[].version`           | `version`            |
| `$.product_statuses[].current`           | `current_version`    |
| `$.product_statuses[].latest`            | `latest`             |
| `$.product_statuses[].listing_status`    | `listing_status`     |
| `$.product_statuses[].validation_status` | `validation_status`  |
| `$.product_statuses[].is_changed`        | `is_changed`         |
| `$.product_statuses[].created`           | `created`            |
| `$.product_statuses[].created_by`        | `created_by`         |
| `$.product_statuses[].last_modified`     | `last_modified`      |
| `$.product_statuses[].last_modified_by`  | `last_modified_by`   |

### **Product Catalog Status Errors**

**Endpoint:** [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog` (nested in product statuses)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_catalog_status_errors`

| JSON Element                                   | Column               |
| ---------------------------------------------- | -------------------- |
| `$.id`                                         | `product_catalog_id` |
| `$.product_statuses[].id`                      | `status_id`          |
| `$.product_statuses[].errors[].category`       | `category`           |
| `$.product_statuses[].errors[].reason`         | `reason`             |
| `$.product_statuses[].errors[].type`           | `type`               |
| `$.product_statuses[].errors[].error_code`     | `error_code`         |
| `$.product_statuses[].errors[].error_severity` | `error_severity`     |
| `$.product_statuses[].errors[].field_name`     | `field_name`         |
| `$.product_statuses[].errors[].partner_action` | `partner_action`     |

### **Product Catalog Fields**

**Endpoint:** [Products Catalog](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/products_catalog` (nested in products catalog response)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_catalog_fields`

| JSON Element       | Column                 |
| ------------------ | ---------------------- |
| `$.id`             | `product_catalog_id`   |
| `$.tcin`           | `product_catalog_tcin` |
| `$.fields[].name`  | `name`                 |
| `$.fields[].value` | `value`                |

### **Product Details**

**Endpoint:** [Item Taxonomy Details](https://developer.target.com) - `GET /item_taxonomies/v2/items/{tcin}` (called for each product in catalog)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_details`

| JSON Element                              | Column                                  |
| ----------------------------------------- | --------------------------------------- |
| `$.tcin`                                  | `tcin`                                  |
| `$.scheduled_launch_date`                 | `scheduled_launch_date`                 |
| `$.color`                                 | `color`                                 |
| `$.published`                             | `published`                             |
| `$.release_date`                          | `release_date`                          |
| `$.size`                                  | `size`                                  |
| `$.street_date`                           | `street_date`                           |
| `$.product_group_id`                      | `product_group_id`                      |
| `$.product_group_name`                    | `product_group_name`                    |
| `$.product_subtype_id`                    | `product_subtype_id`                    |
| `$.product_subtype_name`                  | `product_subtype_name`                  |
| `$.merch_type_id`                         | `merch_type_id`                         |
| `$.merch_type_name`                       | `merch_type_name`                       |
| `$.department_name`                       | `department_name`                       |
| `$.class_id`                              | `class_id`                              |
| `$.class_name`                            | `class_name`                            |
| `$.product_title`                         | `product_title`                         |
| `$.product_long_description`              | `product_long_description`              |
| `$.manufacturer`                          | `manufacturer`                          |
| `$.brand` (array joined)                  | `brand`                                 |
| `$.item_status`                           | `item_status`                           |
| `$.item_status_code`                      | `item_status_code`                      |
| `$.launch_date`                           | `launch_date`                           |
| `$.guest_facing_brand`                    | `guest_facing_brand`                    |
| `$.relationship_type`                     | `relationship_type`                     |
| `$.parent_sku`                            | `parent_sku`                            |
| `$.upcs` (array joined)                   | `upcs`                                  |
| `$.primary_product_details_location_code` | `primary_product_details_location_code` |
| `$.item_type_category`                    | `item_type_category`                    |
| `$.item_type`                             | `item_type`                             |
| `$.item_type_name`                        | `item_type_name`                        |

### **Product Detail Merch Type Attributes**

**Endpoint:** [Item Taxonomy Details](https://developer.target.com) - `GET /item_taxonomies/v2/items/{tcin}` (nested in product details response)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_detail_merch_type_attributes`

| JSON Element                                | Column            |
| ------------------------------------------- | ----------------- |
| `$.tcin`                                    | `tcin`            |
| `$.merch_type_attributes[].id`              | `id`              |
| `$.merch_type_attributes[].name`            | `name`            |
| `$.merch_type_attributes[].value_id`        | `value_id`        |
| `$.merch_type_attributes[].value`           | `value`           |
| `$.merch_type_attributes[].unit_of_measure` | `unit_of_measure` |

### **Product Returns**

**Endpoint:** [Product Returns](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/product_returns`

**Update Method:** UPSERT

**Table Name:** `target_plus.product_returns`

| JSON Element              | Column                  |
| ------------------------- | ----------------------- |
| `$.id`                    | `product_return_id`     |
| `$.order_id`              | `order_id`              |
| `$.order_number`          | `order_number`          |
| `$.seller_id`             | `seller_id`             |
| `$.return_order_number`   | `return_order_number`   |
| `$.tcin`                  | `tcin`                  |
| `$.external_id`           | `external_id`           |
| `$.quantity`              | `quantity`              |
| `$.return_reason`         | `return_reason`         |
| `$.return_date`           | `return_date`           |
| `$.is_online`             | `is_online`             |
| `$.physical_disposition`  | `physical_disposition`  |
| `$.financial_disposition` | `financial_disposition` |
| `$.location_id`           | `location_id`           |
| `$.customer_can_keep`     | `customer_can_keep`     |
| `$.reference_id`          | `reference_id`          |
| `$.created`               | `created`               |
| `$.expires_on`            | `expires_on`            |
| `$.last_modified`         | `last_modified`         |
| `$.skip_charge_back`      | `skip_charge_back`      |
| `$.registry_item`         | `registry_item`         |

### **Product Return Tracking Data**

**Endpoint:** [Product Returns](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/product_returns` (nested in product returns response)

**Update Method:** UPSERT

**Table Name:** `target_plus.product_return_tracking_data`

| JSON Element                                   | Column                       |
| ---------------------------------------------- | ---------------------------- |
| `$.id`                                         | `product_return_id`          |
| `$.tracking_data[].license_plate`              | `license_plate`              |
| `$.tracking_data[].store_physical_disposition` | `store_physical_disposition` |
| `$.tracking_data[].inventory_removal_reason`   | `inventory_removal_reason`   |

### **Distribution Centers**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers`

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_centers`

| JSON Element             | Column                   |
| ------------------------ | ------------------------ |
| `$.id`                   | `distribution_center_id` |
| `$.name`                 | `name`                   |
| `$.timezone`             | `timezone`               |
| `$.created`              | `created`                |
| `$.created_by`           | `created_by`             |
| `$.last_modified`        | `last_modified`          |
| `$.last_modified_by`     | `last_modified_by`       |
| `$.vmm_id`               | `vmm_id`                 |
| `$.address.address1`     | `address_address_1`      |
| `$.address.city`         | `address_city`           |
| `$.address.state`        | `address_state`          |
| `$.address.postal_code`  | `address_postal_code`    |
| `$.address.country_code` | `address_country_code`   |

### **Distribution Center Days of Operation Working Hours**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers` (nested in distribution centers response)

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_center_days_of_operation_working_hours`

| JSON Element                                     | Column                   |
| ------------------------------------------------ | ------------------------ |
| `$.id`                                           | `distribution_center_id` |
| `$.days_of_operation.working_hours[].day`        | `day`                    |
| `$.days_of_operation.working_hours[].open_time`  | `open_time`              |
| `$.days_of_operation.working_hours[].close_time` | `close_time`             |

### **Distribution Center Days of Operation Days Closed**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers` (nested in distribution centers response)

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_center_days_of_operation_days_closed`

| JSON Element                        | Column                   |
| ----------------------------------- | ------------------------ |
| `$.id`                              | `distribution_center_id` |
| `$.days_of_operation.days_closed[]` | `day`                    |

### **Distribution Center Ship Nodes**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers` (nested in distribution centers response)

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_center_ship_nodes`

| JSON Element                           | Column                   |
| -------------------------------------- | ------------------------ |
| `$.id`                                 | `distribution_center_id` |
| `$.ship_nodes[].id`                    | `ship_node_id`           |
| `$.ship_nodes[].name`                  | `name`                   |
| `$.ship_nodes[].building_lead_time_id` | `building_lead_time_id`  |
| `$.ship_nodes[].created`               | `created`                |
| `$.ship_nodes[].created_by`            | `created_by`             |
| `$.ship_nodes[].last_modified`         | `last_modified`          |
| `$.ship_nodes[].last_modified_by`      | `last_modified_by`       |
| `$.ship_nodes[].vmm_id`                | `vmm_id`                 |

### **Distribution Center Ship Node Carriers**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers` (nested in ship nodes)

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_center_ship_node_carriers`

| JSON Element                   | Column                   |
| ------------------------------ | ------------------------ |
| `$.id`                         | `distribution_center_id` |
| `$.ship_nodes[].id`            | `ship_node_id`           |
| `$.ship_nodes[].carriers[].id` | `carrier_id`             |

### **Distribution Center Ship Node Service Levels**

**Endpoint:** [Distribution Centers](https://developer.target.com) - `GET /sellers/v1/sellers/{x-seller-id}/distribution_centers` (nested in ship nodes)

**Update Method:** UPSERT

**Table Name:** `target_plus.distribution_center_ship_node_service_levels`

| JSON Element                                              | Column                    |
| --------------------------------------------------------- | ------------------------- |
| `$.id`                                                    | `distribution_center_id`  |
| `$.ship_nodes[].id`                                       | `ship_node_id`            |
| `$.ship_nodes[].service_levels[].id`                      | `service_level_id`        |
| `$.ship_nodes[].service_levels[].cut_off_time`            | `cut_off_time`            |
| `$.ship_nodes[].service_levels[].generic_time_in_transit` | `generic_time_in_transit` |

### **Order Fulfillments**

**Endpoint:** [Order Fulfillments](https://developer.target.com) - `GET /seller_orders/v1/sellers/{x-seller-id}/orders/{order-id}/fulfillments`

**Update Method:** UPSERT

**Table Name:** `target_plus.order_fulfillments`

| JSON Element          | Column              |
| --------------------- | ------------------- |
| `$.id`                | `fulfillment_id`    |
| `$.order_id`          | `order_id`          |
| `$.order_line_number` | `order_line_number` |
| `$.seller_id`         | `seller_id`         |
| `$.quantity`          | `quantity`          |
| `$.shipped_date`      | `shipped_date`      |
| `$.shipping_method`   | `shipping_method`   |
| `$.tracking_number`   | `tracking_number`   |
| `$.created`           | `created`           |
| `$.created_by`        | `created_by`        |
| `$.last_modified`     | `last_modified`     |
| `$.last_modified_by`  | `last_modified_by`  |

### **Shipping Methods**

**Endpoint:** [Shipping Methods](https://developer.target.com) - `GET /seller_orders/v1/shipping_methods`

**Update Method:** UPSERT

**Table Name:** `target_plus.shipping_methods`

| JSON Element         | Column               |
| -------------------- | -------------------- |
| `$.id`               | `shipping_method_id` |
| `$.shipping_method`  | `shipping_method`    |
| `$.carrier`          | `carrier`            |
| `$.scac`             | `scac`               |
| `$.service_code`     | `service_code`       |
| `$.created`          | `created`            |
| `$.last_modified`    | `last_modified`      |
| `$.last_modified_by` | `last_modified_by`   |
