Locations API in Wasabi AiR
    • 20 May 2024
    • 2 Minutes to read
    • PDF

    Locations API in Wasabi AiR

    • PDF

    Article summary

    A location is where source files are stored. A location has a kind, name, and map of kind-specific configuration values. Example location kinds include Microsoft Azure Blob Store, Amazon S3, OpenStack Swift, and local or network-attached storage. Each location is assigned a system-wide unique ID, which must be used when issuing harvesting requests (as described in Harvesting).

    Location Object

    A location object describes a single storage location available for harvesting.

    {
    	"id": "{location_id}",
    	"kind": "{kind}",
    	"name": "{name}",
    	"config": {
    		"{configuration-key}": "{value}",
    	"groups": [],
    	"version": 0
    	}
    }
    • id - (string) A system-generated unique ID.
    • kind - (string) The location kind being added. This must be present in the supported Location Kinds API.
    • name - (string) A human-readable name for the location (for example, Post Production).
    • config- (object) Key/value pairs of strings representing the configuration of the location.
      • configuration-key - (string) The configuration key.
      • configuration-value - (string) The configuration value.
    • groups - (array) Groups associated with this location (see the Users and Groups API).
    • version - (int) The version number of the location object. When a current version is updated, this value automatically increments by one (1).

    The configuration object depends on the kind of location to which it is being connected. For a complete breakdown, refer to the supported Location Kinds API.

    Connecting to a Location

    To connect Wasabi AiR to a location, add it using the following API call:

    POST /api/data/v3/locations
    {
    	"kind": "{kind}",
    	"name": "{name}",
    	"config": {
    		"{configuration-key}": "{value}"
    	}
    }
    

    Response

    The system sets the version number to zero (0) and generates a unique ID for the location, which is added to the object in the response:

    {
    	"id": "{location-id}",
    	"kind": "{kind}",
    	"name": "{name}",
    	"config": {
    		"{configuration-key}": "{value}",
    	"groups": null,
    	"version": 0
    	}
    }
    • location-id - (string) The unique ID representing the location.
    • version - (integer) A value to track changes in the location object.

    Failed Configuration

    When you add a location, Wasabi AiR immediately attempts to connect to it. If this fails, you receive a non-2xx response and a description of the error in the body.

    Reading Locations

    To get a list of locations, make the following request:

    GET /api/data/v3/locations

    Response

    You receive a location object with an array of locations:

    {
    	"locations": [
    		{
    			"id": "{location-id}",
    			"kind": "{kind}",
    			"name": "{name}",
    			"config": {
    				"{configuration-key}": "{value}"
    			}
    		},
    		{
    			"id": "{location-id}",
    			"kind": "{kind}",
    			"name": "{name}",
    			"config": {
    				"{configuration-key}": "{value}"
    			}
    		}
    	]
    }

    Reading Containers

    To get a list of containers at a given location, refer to the Containers API.

    Reading a Single Location

    If you know the ID of the location you want to read, you can make the following request:

    GET /api/data/v3/locations/{id}
    • {id} - (string) The location ID.

    Response

    The response is a single location object:

    {
    	"id": "{location-id}",
    	"kind": "{kind}",
    	"name": "{name}",
    	"config": {
    		"{configuration-key}": "{value}",
    	"groups": [],
    	"version": 1
    	}
    }

    Updating a Location

    You can post changes to a location by making the following request:

    PUT /api/data/v3/locations/{id}
    {
    	"kind": "{kind}",
    	"name": "{name}",
    	"config": {
    		"{configuration-key}": "{value}"
    	},
    	"version": 1
    }
    • {id} - (string) The location ID.
    The version in your request must match the current version.

    The settings is validated when Wasabi AiR attempts to connect to the location, as it did when creating locations.

    Response

    The response is the updated location object with the version number incremented by one (1).

    Deleting a Location

    While you can delete a location using the predictable RESTful approach, it is not recommended at this time.

    Loadnstore Upload

    Posting an asset to the loadnstore fileapi endpoint creates a file in Wasabi AiR file_api location and kicks off a harvest of the new file.

    POST /files/loadnstore/{path_to_file}

    Loadnstore Delete

    This deletes an item and all its artifacts (metadata.json, original asset, thumbnails, and so on) from the mf2 platform. The following requires that you send the same path that you used to upload the original asset.

    DELETE /files/loadnstore/{path_to_file}



    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence