> For the complete documentation index, see [llms.txt](https://woowup-docs.gitbook.io/woowup-developer-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://woowup-docs.gitbook.io/woowup-developer-docs/data-processing/woowup-connectors.md).

# WoowUp Connectors

## Get total account stats

<mark style="color:blue;">`GET`</mark> `https://api.woowup.com/apiv3/stats`

#### Query Parameters

| Name   | Type   | Description                                     |
| ------ | ------ | ----------------------------------------------- |
| to     | string | Filter by createtime of customers and purchases |
| from   | string | Filter by createtime of customers and purchases |
| branch | string | Filter by branch name                           |

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

```javascript
{
	"total_customers": 100,
	"total_purchases": 200,
	"total_revenue": 300000,
	"total_invoice_items": 600,
	"per_branches": [
		{
			"branch": "Shopping Unicenter",
			"total_customers": 100,
			"total_purchases": 200,
			"total_revenue": 300000,
			"total_invoice_items": 600,
		}
	]
}
```

{% endtab %}
{% endtabs %}

## Create a data processing record

<mark style="color:green;">`POST`</mark> `https://connectors.woowup.com/v1/log`

#### Headers

| Name          | Type   | Description              |
| ------------- | ------ | ------------------------ |
| Authorization | string | Bearer \[WoowUp API KEY] |

#### Request Body

| Name          | Type   | Description                                     |
| ------------- | ------ | ----------------------------------------------- |
| processedtime | string | Processing time (DateTime ISO-8601)             |
| stats         | object | Processed entities and their related statistics |
| files         | array  | Processed file names                            |

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

```javascript
{
	"files": ["customers-2019_03_11.csv", "purchases-2019_03_11.csv"],
	"processingtime": "2019-03-12T12:30:00+00:00",
	"createtime": "2019-03-12T12:30:00+00:00",
	"stats": {
		"customers": {
			"total_created": 200,
			"total_updated": 10,
			"total_failed": 2,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"created": 200,
					"updated": 10,
					"failed": 2
				}
			]
		},
		"purchases": {
			"total_created": 300,
			"total_updated": 1,
			"total_failed": 1,
			"total_revenue": 300000,
			"total_invoice_items": 5000,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"total_created": 300,
					"total_updated": 1,
					"total_failed": 1,
					"total_revenue": 300000,
					"total_invoice_items": 5000
				}
			]
		},
		"products": {
			"total_created": 20,
			"total_updated": 5,
			"total_failed": 0
		},
		"branches": {
			"total_created": 1,
			"total_updated": 3
		}
	}
}
```

{% endtab %}
{% endtabs %}

```javascript
{
	"files": ["customers-2019_03_11.csv", "purchases-2019_03_11.csv"],
	"processingtime": "2019-03-12T12:30:00+00:00",
	"stats": {
		"customers": {
			"total_created": 200,
			"total_updated": 10,
			"total_failed": 2,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"created": 200,
					"updated": 10,
					"failed": 2
				}
			]
		},
		"purchases": {
			"total_created": 300,
			"total_updated": 1,
			"total_failed": 1,
			"total_revenue": 300000,
			"total_invoice_items": 5000,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"total_created": 300,
					"total_updated": 1,
					"total_failed": 1,
					"total_revenue": 300000,
					"total_invoice_items": 5000
				}
			]
		},
		"products": {
			"total_created": 20,
			"total_updated": 5,
			"total_failed": 0
		},
		"branches": {
			"total_created": 1,
			"total_updated": 3
		}
	}
}
```

#### JSON SCHEMA

```javascript
{
  "definitions": {},
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "http://example.com/root.json",
  "type": "object",
  "required": [
    "files",
    "processingtime",
    "stats"
  ],
  "properties": {
    "files": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^(.*)$"
      }
    },
    "processingtime": {
      "type": "string",
      "pattern": "^(.*)$"
    },
    "stats": {
      "type": "object",
      "properties": {
        "customers": {
          "type": "object",
          "required": [
            "total_created",
            "total_updated",
            "total_failed"
          ],
          "properties": {
            "total_created": {
              "type": "integer"
            },
            "total_updated": {
              "type": "integer"
            },
            "total_failed": {
              "type": "integer"
            },
            "per_branches": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "branch",
                  "total_created",
                  "total_updated",
                  "total_failed"
                ],
                "properties": {
                  "branch": {
                    "type": "string",
                    "pattern": "^(.*)$"
                  },
                  "total_created": {
                    "type": "integer"
                  },
                  "total_updated": {
                    "type": "integer"
                  },
                  "total_failed": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "purchases": {
          "type": "object",
          "required": [
            "total_created",
            "total_updated",
            "total_failed",
            "total_revenue",
            "total_invoice_items",
            "per_branches"
          ],
          "properties": {
            "total_created": {
              "type": "integer"
            },
            "total_updated": {
              "type": "integer"
            },
            "total_failed": {
              "type": "integer"
            },
            "total_revenue": {
              "type": "integer"
            },
            "total_invoice_items": {
              "type": "integer"
            },
            "per_branches": {
              "type": "array",
              "items": {
                "type": "object",
                "required": [
                  "branch",
                  "total_created",
                  "total_updated",
                  "total_failed",
                  "total_revenue",
                  "total_invoice_items"
                ],
                "properties": {
                  "branch": {
                    "type": "string",
                    "pattern": "^(.*)$"
                  },
                  "total_created": {
                    "type": "integer"
                  },
                  "total_updated": {
                    "type": "integer"
                  },
                  "total_failed": {
                    "type": "integer"
                  },
                  "total_revenue": {
                    "type": "integer"
                  },
                  "total_invoice_items": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        },
        "products": {
          "type": "object",
          "required": [
            "total_created",
            "total_updated",
            "total_failed"
          ],
          "properties": {
            "total_created": {
              "type": "integer"
            },
            "total_updated": {
              "type": "integer"
            },
            "total_failed": {
              "type": "integer"
            }
          }
        },
        "branches": {
          "type": "object",
          "required": [
            "total_created",
            "total_updated"
          ],
          "properties": {
            "total_created": {
              "type": "integer"
            },
            "total_updated": {
              "type": "integer"
            }
          }
        }
      }
    }
  }
}
```

## List the stats processed by your connector

<mark style="color:blue;">`GET`</mark> `https://connectors.woowup.com/v1/logs`

#### Query Parameters

| Name   | Type   | Description                                              |
| ------ | ------ | -------------------------------------------------------- |
| entity | string | Can be: "customers", "purchases", "products", "branches" |
| page   | number | Default: 0                                               |
| limit  | number | Default: 25                                              |
| to     | string | Filter by processing date (YYYY-MM-DD)                   |
| from   | string | Filter by processing date (YYYY-MM-DD)                   |

#### Headers

| Name          | Type   | Description              |
| ------------- | ------ | ------------------------ |
| Authorization | string | Bearer \[WoowUp API KEY] |

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

```javascript
[
{
	"files": ["customers-2019_03_11.csv", "purchases-2019_03_11.csv"],
	"processingtime": "2019-03-12T12:30:00+00:00",
	"createtime": "2019-03-12T12:30:00+00:00",
	"stats": {
		"customers": {
			"total_created": 200,
			"total_updated": 10,
			"total_failed": 2,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"created": 200,
					"updated": 10,
					"failed": 2
				}
			]
		},
		"purchases": {
			"total_created": 300,
			"total_updated": 1,
			"total_failed": 1,
			"total_revenue": 300000,
			"total_invoice_items": 5000,
			"per_branches": [
				{
					"branch": "Shopping Unicenter",
					"total_created": 300,
					"total_updated": 1,
					"total_failed": 1,
					"total_revenue": 300000,
					"total_invoice_items": 5000
				}
			]
		},
		"products": {
			"total_created": 20,
			"total_updated": 5,
			"total_failed": 0
		},
		"branches": {
			"total_created": 1,
			"total_updated": 3
		}
	}
}
]
```

{% endtab %}
{% endtabs %}
