Source: https://developers.woosmap.com/api-reference/data-api/post-stores-replace/

> For clean Markdown of any page, append `.md` to the page URL.

> For a complete documentation index, see https://developers.woosmap.com/llms.txt

# Replace all assets



# Replace all assets

 POST 
https://api.woosmap.com/stores/replace

To replace all your Assets. This endpoint will delete all previous assets and import assets in request body. During the operation previous assets could always be displayed on map. If the import failed previous assets are not deleted.

### Authorization

[`private_key`](#authorization-woosmap-platform-api-reference-privateapikeyauth)
apiKeyquery

A Private key generated specifically to authenticate API requests on server side. Required for Data management API. See how to [register a Private API Key](https://developers.woosmap.com/api-reference/authentication/#registering-a-woosmap-private-api-key).

### Request Body

application/json

The request body of Stores Replace must be formatted as JSON.

[`stores`](#req-stores)
object[]required

The Assets collection

#Show 10 propertiesHide 10 properties

stores.[`location`](#req-stores-location)
objectrequired

An object describing a specific location with Latitude and Longitude in decimal degrees.

Example:

```json
{
  "lat": 43.3,
  "lng": 3.46
}
```

Show 2 propertiesHide 2 properties

stores.location.[`lat`](#req-stores-location-lat)
numberrequired

Latitude in decimal degrees

Example:`42.3`

stores.location.[`lng`](#req-stores-location-lng)
numberrequired

Longitude in decimal degrees

Example:`3.46`

stores.[`name`](#req-stores-name)
stringrequired

The asset's name.

Example:`My Cool Store`

stores.[`storeId`](#req-stores-storeid)
stringrequired

A textual identifier that uniquely identifies an Asset. It must matches the following regexp `[A-Za-z0-9]+`

Example:`STORE_ID_12345`

stores.[`address`](#req-stores-address)
object

An object containing the separate components applicable to this address.

Example:

```json
{
  "lines": [
    "8 Southwark St"
  ],
  "countryCode": "UK",
  "city": "London",
  "zipcode": "WC1E 7BT"
}
```

Show 4 propertiesHide 4 properties

stores.address.[`lines`](#req-stores-address-lines)
string[]

An Array for lines of an Asset Address

Example:

```json
[
  "Building Centre",
  "26 Store Street"
]
```

stores.address.[`countryCode`](#req-stores-address-countrycode)
string | null

An ISO\_3166-1 Country Code where the Asset is located (see [https://en.wikipedia.org/wiki/ISO\_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) for full list)

Example:`UK`

stores.address.[`city`](#req-stores-address-city)
string

A City where belongs an Asset

Example:`London`

stores.address.[`zipcode`](#req-stores-address-zipcode)
string

An Zipcode / Postal code of an Asset Address

Example:`WC1E 7BT`

stores.[`contact`](#req-stores-contact)
object

An object containing the asset's contact available information.

Example:

```json
{
  "website": "https://www.woosmap.com",
  "phone": "+44 20 7693 4000",
  "email": "contact@woosmap.com"
}
```

Show 3 propertiesHide 3 properties

stores.contact.[`website`](#req-stores-contact-website)
string

The website contact for this Asset, such as a business' homepage.

Example:`https://www.woosmap.com`

stores.contact.[`phone`](#req-stores-contact-phone)
string

Contains the Asset's phone number in its [local format](https://en.wikipedia.org/wiki/Local_conventions_for_writing_telephone_numbers).

Example:`+44 20 7693 4000`

stores.contact.[`email`](#req-stores-contact-email)
string

Contains the Asset's email contact.

Example:`contact@woosmap.com`

stores.[`types`](#req-stores-types)
string[]

Contains an array of types describing the Asset.

Example:

```json
[
  "drive",
  "click_and_collect"
]
```

stores.[`tags`](#req-stores-tags)
string[]

Contains an array of tags describing the Asset. For example a list of available amenities.

Example:

```json
[
  "wifi",
  "covered_parking"
]
```

stores.[`userProperties`](#req-stores-userproperties)
object | null

Contains all additional information relative to an Asset. If not set it returns null value.

Example:

```json
{
  "some_user_properties": "some_value"
}
```

stores.[`localizedNames`](#req-stores-localizednames)
object

Alternate names for your assets. These localized names are useful for multi-language integrations. Combined with our Autocomplete API endpoint you can let your users find your store in their native language.

Example:

```json
{
  "ar": "مركز فيليتزي التجاري",
  "fr": "Centre Commercial Velizy",
  "it": "Centro Commerciale Velizy",
  "gb": "Velizy Shopping Center"
}
```

stores.[`openingHours`](#req-stores-openinghours)
object | null

An object describing the opening hours of an Asset.

Example:

```json
{
  "timezone": "Europe/London",
  "usual": {
    "1": [],
    "default": [
      {
        "start": "08:30",
        "end": "22:00"
      }
    ]
  },
  "special": {
    "2015-02-07": [
      {
        "start": "08:00",
        "end": "23:00"
      }
    ]
  }
}
```

Show 3 propertiesHide 3 properties

stores.openingHours.[`timezone`](#req-stores-openinghours-timezone)
string

Timezone for the Opening Hours of an Asset. It is used to compute the `open_now` property of an asset. see [https://en.wikipedia.org/wiki/List\_of\_tz\_database\_time\_zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)

Example:`Europe/London`

stores.openingHours.[`usual`](#req-stores-openinghours-usual)
object

An object describing the usual opening hours of an Asset.

Show 8 propertiesHide 8 properties

stores.openingHours.usual.[`1`](#req-stores-openinghours-usual-1)
object[]

The opening Hours for Monday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.1.[`start`](#req-stores-openinghours-usual-1-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.1.[`end`](#req-stores-openinghours-usual-1-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`2`](#req-stores-openinghours-usual-2)
object[]

The opening Hours for Tuesday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.2.[`start`](#req-stores-openinghours-usual-2-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.2.[`end`](#req-stores-openinghours-usual-2-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`3`](#req-stores-openinghours-usual-3)
object[]

The opening Hours for Wednesday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.3.[`start`](#req-stores-openinghours-usual-3-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.3.[`end`](#req-stores-openinghours-usual-3-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`4`](#req-stores-openinghours-usual-4)
object[]

The opening Hours for Thursday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.4.[`start`](#req-stores-openinghours-usual-4-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.4.[`end`](#req-stores-openinghours-usual-4-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`5`](#req-stores-openinghours-usual-5)
object[]

The opening Hours for Friday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.5.[`start`](#req-stores-openinghours-usual-5-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.5.[`end`](#req-stores-openinghours-usual-5-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`6`](#req-stores-openinghours-usual-6)
object[]

The opening Hours for Saturday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.6.[`start`](#req-stores-openinghours-usual-6-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.6.[`end`](#req-stores-openinghours-usual-6-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`7`](#req-stores-openinghours-usual-7)
object[]

The opening Hours for Sunday

Show 2 propertiesHide 2 properties

stores.openingHours.usual.7.[`start`](#req-stores-openinghours-usual-7-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.7.[`end`](#req-stores-openinghours-usual-7-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.usual.[`default`](#req-stores-openinghours-usual-default)
object[]

Contains the default opening hours to apply to all week days

Show 2 propertiesHide 2 properties

stores.openingHours.usual.default.[`start`](#req-stores-openinghours-usual-default-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.usual.default.[`end`](#req-stores-openinghours-usual-default-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.[`special`](#req-stores-openinghours-special)
object

An object describing the special opening hours of an Asset.

Show 2 propertiesHide 2 properties

stores.openingHours.special.[`2015-02-07`](#req-stores-openinghours-special-2015-02-07)
object[]

The format for defining opening and closing hours for a particular day is the same as the usual. Instead of using numeric week day for keys you must use a date YYYY-MM-DD like "2015-03-08" (see ISO-8601).

Show 2 propertiesHide 2 properties

stores.openingHours.special.2015-02-07.[`start`](#req-stores-openinghours-special-2015-02-07-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.special.2015-02-07.[`end`](#req-stores-openinghours-special-2015-02-07-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

stores.openingHours.special.[`2015-02-08`](#req-stores-openinghours-special-2015-02-08)
object[]

Show 2 propertiesHide 2 properties

stores.openingHours.special.2015-02-08.[`start`](#req-stores-openinghours-special-2015-02-08-start)
stringrequired

Contains a time of day in 24-hour hh:mm format for the begin of opening period. Values are in the range 00:00–23:59

Example:`08:30`

stores.openingHours.special.2015-02-08.[`end`](#req-stores-openinghours-special-2015-02-08-end)
stringrequired

Contains a time of day in 24-hour hh:mm format for the end of opening period. Values are in the range 00:00–23:59

Example:`19:30`

##### Example

```json
{
  "stores": [
    {
      "types": [
        "drive",
        "click_and_collect"
      ],
      "tags": [
        "wifi",
        "covered_parking"
      ],
      "location": {
        "lat": 38.719,
        "lng": -77.1067
      },
      "storeId": "STORE_ID_123456",
      "name": "My Cool Store",
      "address": {
        "lines": [
          "Building Centre",
          "26 Store Street"
        ],
        "countryCode": "UK",
        "city": "London",
        "zipcode": "WC1E 7BT"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "Europe/London",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        },
        "special": {
          "2015-02-07": [
            {
              "start": "08:00",
              "end": "23:00"
            }
          ]
        }
      }
    },
    {
      "types": [
        "drive"
      ],
      "tags": [
        "covered_parking"
      ],
      "location": {
        "lat": 38.5239,
        "lng": -77.0157
      },
      "storeId": "STORE_ID_45678",
      "name": "My Cool Store 2",
      "address": {
        "lines": [
          "1805-1899",
          "Orchard St"
        ],
        "countryCode": "US",
        "city": "Alexandria",
        "zipcode": "22309"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "America/New_York",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        }
      }
    }
  ]
}
```

### Response

200application/json

Assets successfully replaced

[`status`](#resp-200-status)
string

the status of the 200 response

Example:`success`

[`value`](#resp-200-value)
string | integer

The value of request for this 200 response

Example:`129 stores`

### Errors

#400

Invalid. The data is not a valid JSON.

 

`application/json`

[`status`](#err-400-status)
string

the status of the 400 response

Example:`error`

[`value`](#err-400-value)
string

the value of request causing the Error

Example:`The request is invalid, the data is not a valid JSON.`

#401

Unauthorized. Incorrect authentication credentials.

 

`application/json`

[`detail`](#err-401-detail)
string

Details for the credentials error

Example:`Incorrect authentication credentials. Please check or use a valid API Key`

#403

Forbidden. This Woosmap API is not enabled for this project.

 

`application/json`

[`detail`](#err-403-detail)
string

Details for the forbidden error message

Example:`This Woosmap API is not enabled for this project.`

```shell
curl -L 'https://api.woosmap.com/stores/replace?private_key=YOUR_PRIVATE_API_KEY' \
-H 'content-type: application/json' \
--data-raw '{
  "stores": [
    {
      "types": [
        "drive",
        "click_and_collect"
      ],
      "tags": [
        "wifi",
        "covered_parking"
      ],
      "location": {
        "lat": 38.719,
        "lng": -77.1067
      },
      "storeId": "STORE_ID_123456",
      "name": "My Cool Store",
      "address": {
        "lines": [
          "Building Centre",
          "26 Store Street"
        ],
        "countryCode": "UK",
        "city": "London",
        "zipcode": "WC1E 7BT"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "Europe/London",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        },
        "special": {
          "2015-02-07": [
            {
              "start": "08:00",
              "end": "23:00"
            }
          ]
        }
      }
    },
    {
      "types": [
        "drive"
      ],
      "tags": [
        "covered_parking"
      ],
      "location": {
        "lat": 38.5239,
        "lng": -77.0157
      },
      "storeId": "STORE_ID_45678",
      "name": "My Cool Store 2",
      "address": {
        "lines": [
          "1805-1899",
          "Orchard St"
        ],
        "countryCode": "US",
        "city": "Alexandria",
        "zipcode": "22309"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "America/New_York",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        }
      }
    }
  ]
}'
```

```python
import requests
import json

url = "https://api.woosmap.com/stores/replace?private_key=YOUR_PRIVATE_API_KEY"

payload = json.dumps({
    "stores": [
        {
            "types": [
                "drive",
                "click_and_collect"
            ],
            "tags": [
                "wifi",
                "covered_parking"
            ],
            "location": {
                "lat": 38.719,
                "lng": -77.1067
            },
            "storeId": "STORE_ID_123456",
            "name": "My Cool Store",
            "address": {
                "lines": [
                    "Building Centre",
                    "26 Store Street"
                ],
                "countryCode": "UK",
                "city": "London",
                "zipcode": "WC1E 7BT"
            },
            "contact": {
                "website": "https://www.woosmap.com",
                "phone": "+44 20 7693 4000",
                "email": "contact@woosmap.com"
            },
            "userProperties": {
                "some_user_properties": "associated user value"
            },
            "openingHours": {
                "timezone": "Europe/London",
                "usual": {
                    "1": [],
                    "default": [
                        {
                            "start": "08:30",
                            "end": "22:00"
                        }
                    ]
                },
                "special": {
                    "2015-02-07": [
                        {
                            "start": "08:00",
                            "end": "23:00"
                        }
                    ]
                }
            }
        },
        {
            "types": [
                "drive"
            ],
            "tags": [
                "covered_parking"
            ],
            "location": {
                "lat": 38.5239,
                "lng": -77.0157
            },
            "storeId": "STORE_ID_45678",
            "name": "My Cool Store 2",
            "address": {
                "lines": [
                    "1805-1899",
                    "Orchard St"
                ],
                "countryCode": "US",
                "city": "Alexandria",
                "zipcode": "22309"
            },
            "contact": {
                "website": "https://www.woosmap.com",
                "phone": "+44 20 7693 4000",
                "email": "contact@woosmap.com"
            },
            "userProperties": {
                "some_user_properties": "associated user value"
            },
            "openingHours": {
                "timezone": "America/New_York",
                "usual": {
                    "1": [],
                    "default": [
                        {
                            "start": "08:30",
                            "end": "22:00"
                        }
                    ]
                }
            }
        }
    ]
})
headers = {
    'content-type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

```javascript
const axios = require('axios');
let data = JSON.stringify({
  "stores": [
    {
      "types": [
        "drive",
        "click_and_collect"
      ],
      "tags": [
        "wifi",
        "covered_parking"
      ],
      "location": {
        "lat": 38.719,
        "lng": -77.1067
      },
      "storeId": "STORE_ID_123456",
      "name": "My Cool Store",
      "address": {
        "lines": [
          "Building Centre",
          "26 Store Street"
        ],
        "countryCode": "UK",
        "city": "London",
        "zipcode": "WC1E 7BT"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "Europe/London",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        },
        "special": {
          "2015-02-07": [
            {
              "start": "08:00",
              "end": "23:00"
            }
          ]
        }
      }
    },
    {
      "types": [
        "drive"
      ],
      "tags": [
        "covered_parking"
      ],
      "location": {
        "lat": 38.5239,
        "lng": -77.0157
      },
      "storeId": "STORE_ID_45678",
      "name": "My Cool Store 2",
      "address": {
        "lines": [
          "1805-1899",
          "Orchard St"
        ],
        "countryCode": "US",
        "city": "Alexandria",
        "zipcode": "22309"
      },
      "contact": {
        "website": "https://www.woosmap.com",
        "phone": "+44 20 7693 4000",
        "email": "contact@woosmap.com"
      },
      "userProperties": {
        "some_user_properties": "associated user value"
      },
      "openingHours": {
        "timezone": "America/New_York",
        "usual": {
          "1": [],
          "default": [
            {
              "start": "08:30",
              "end": "22:00"
            }
          ]
        }
      }
    }
  ]
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.woosmap.com/stores/replace?private_key=YOUR_PRIVATE_API_KEY',
  headers: { 
    'content-type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});
```

```json
{
  "status": "success",
  "value": "2 stores deleted, 2 stores created"
}
```

```json
{
  "status": "error",
  "value": "The request is invalid, the data is not a valid JSON."
}
```

```json
{
  "detail": "Incorrect authentication credentials. Please check or use a valid API Key"
}
```

```json
{
  "detail": "This Woosmap API is not enabled for this project."
}
```
