The newest version of this document can be found online at: https://resources.apnet.ch/api/manage/locations
Last modified: 2021-07-12 17:44 ➔ reload

Automated location management

Only for partners with multiple physical locations

API basics

API methods

Get Locations (GET)

[Base-URL]/locations/get

Returns all locations, which have been created via API (internal hint: location.importerId is not null).

You only have to use this API-Call, if you have to manage multiple locations by yourself.
The servers answer will be empty, if you have an online shop, just one location or your locations are managed by apNet.

Returned JSON:

{
    "success": true,
    "locations": [{
        "uuid": "4e1f73f3-ad9e-4414-a9fd-d5605ac3a350",
        "name": "xyz",
        "address": "Strasse 15",
        "city": "Musterhausen",
        "zip": 3006,
        "poBox": null,
        "phone": "052 123 45 79",
        "fax": null,
        "mail": null,
        "geo": {
            "latitude": 46.941804,
            "longitude": 7.466993
        }
    }, {
        ...
    }]
}

Returned JSON in case of an error:

{
    "success": false,
    "message": "[error-message]"
}

Set Locations (POST)

[Base-URL]/locations/set

Set your locations.

You only have to use this API-Call, if you have to manage multiple locations by yourself.

Manually created locations (e.g. by apNet or via backend) do not get touched by this API.

All locations must be submitted, the ones you don't submit will get marked as deleted.

Required POST data:

[{
    "uuid": 1243,
    "name": null,              // [optional] if not submitted the name will be partner name with location address (e.g. "Restaurant Falken, Schaffhausen, Vorstadt 5")
    "address": "Strasse 15",
    "city": "Musterhausen",
    "zip": 8200,
    "poBox": null,             // [optional]
    "phone": null,             // [optional]
    "fax": null,               // [optional]
    "mail": null,              // [optional]
    "geo": {                   // geoLocation is mandatory, since we display locations on a map
        "latitude": 45.232323,
        "longitude": 123.22321
    }
}, {
    ...
}]

Returned JSON in case of all locations have been successfully created or updated:

{
    "success": true
}

Returned JSON in case of any location had an error:

{
    "success": true,
    "notUpdatedLocationsDueToError": [{
        "uuid": "uuid of submitted location",
        "error": "message describing the problem"
    }, {
        ...
    }]
}