# MatchCustomerProducts

**Description**

The database of the shop does not contain the customer's own product numbers but if this REST API function is implemented the shop can facilitate the use of the customer's own product numbers in the shop's search box.&#x20;

This function can be implemented if the ERP system supports the storage of the customer own product numbers for the products in the ERP.

The shop will pass on the terms found in search query to the MatchCustomerProducts endpoint. The endpoint checks in the ERP if the terms correspond with the own productnumbers of the current customer and and returns the matched productnumbers that are used in the shop. The shop will then complete the search query with this matched/translated productnumbers.

## REST API:

**URL:** /Shoxl/v1/MatchCustomerProducts\
**Method:** POST

**Request body:**

### MatchCustomerProductsRequest{

| accountNumber | <p>string<br>required</p>     | Account number of the customer that is logged in into the shop.         |
| ------------- | ----------------------------- | ----------------------------------------------------------------------- |
| searchTerm    | <p>string </p><p>required</p> | searchterm that may (but does not have to) contain own articlenumber    |
| maxResults    | <p>int<br>required</p>        | the maximum number of matched customerproducts returned in the response |

}

#### Example:

```
{
  "accountNumber": "128",
  "searchTerm": "4321"
}
```

###

**Response body:**

### MatchCustomerProductsResult{

| Parameter        | Type                            | Description                                                                                                                           |
| ---------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| errorCode        | <p>string<br>nullable: true</p> | An error code returned by the ERP system                                                                                              |
| errorDescription | <p>string<br>nullable: true</p> | The error description related to the error code returned by the ERP system                                                            |
| customerProducts | \[CustomerProduct]              | List of matched CustomerProducts. The number of matched customerproducts is limited by the given maxResults parameter in the request. |

}

### CustomerProduc&#x74;**{**

| Parameter        | Type                            | Description                                                      |
| ---------------- | ------------------------------- | ---------------------------------------------------------------- |
| productNumber    | <p>string<br>nullable: true</p> | Product number of the ERP system (that is also used in the shop) |
| ownProductNumber | <p>string<br>nullable: true</p> | The customer's own product number                                |

}&#x20;

#### Example:

```
{
  "errorCode": "string",
  "errorDescription": "string",
  "customerProducts": [
    {
      "productNumber": "90001",
      "ownProductNumber": "4321-12"
    }.
    {
      "productNumber": "70001",
      "ownProductNumber": "4321-55"
    }
  ],
}
```
