API Quickstart

Used for sending data on Woosmap servers
  1. Presentation
    1. Public and Private keys
    2. REST API
    3. Error Handling
  2. Structure of requests
    1. Data sent
  3. Managing assets data
    1. Create assets data
    2. Updating assets data
    3. Deleting assets
    4. Replace all assets

Presentation

Public and Private keys

Upon signing up to Woosmap, you will have access to the API key management interface in each project.

key Description
private_key1 A private key is used for server api calls (POST, PUT and DELETE) where modification of the data occurs.
key A public key is used client side to fetch your project data.

REST API

Where possible the API strives to use appropriate HTTP verbs for each action.

Verb Description
GET Used for retrieving resources.
POST Used for creating resources.
PUT Used for replacing resources or collections.
DELETE Used for deleting resources.

Error Handling

Code Description
20X Indicates success or object creation.
403 if Unauthorized
400 if the request data is wrong.

Additionally the answer might contain a message key, with an human error message as value.

Structure of requests

All data sent and received are in JSON format.

Data sent

The data sent through POST and PUT methods should be in the following format:

{
    "stores": [{"storeId": "0"...}]
}

Each element of the stores array must be in the format explained here .

Managing assets data

The restrictions on POST and PUT on storeIds are made to ensure identifier stability.

Create assets data

Used to create assets in batch.

Warning: storeId must not exists when using POST method, if one store already exists, the batch will be refused.

curl -X POST \
	-H 'Content-Type: application/json' \
	-d @data.json \
	'https://api.woosmap.com/stores?private_key={private_key}'

Updating assets data

Used to update assets in batch.

Warning: storeId must exists when using PUT method, if one asset does not exists, the batch will be refused.

curl -X PUT \
	-H 'Content-Type: application/json' \
	-d @data.json \
	'https://api.woosmap.com/stores?private_key={private_key}'

Deleting assets

You can delete one or more assets using the following url, the storeId is the id you defined. To delete several assets, use the comma as a separator.

curl -X DELETE \
	'https://api.woosmap.com/stores/?query=idstore:\[{storeId1},{storeId2}\]&private_key={private_key}'

Replace all assets

You can replace all assets of a Project using the following url.

curl -X POST \
	-H 'Content-Type: application/json' \
	-d @data.json \
	'https://api.woosmap.com/stores/replace?private_key={private_key}'

This command will delete all previous assets and import assets from the json file.

During the operation previous assets could always be displayed on map.

If the import failed previous assets will not be deleted.

  1. The private key holds destructive power hence it should remain private, the public key can be made public since it’s used client side. 

Was this article helpful?
Have more questions? Submit a request