Send Docs Feedback

Note: Most user interface tasks can be performed in Edge Classic or the New Edge experience. For an overview, getting started topics, and release notes specific to the New Edge experience, see the docs.

Uploading assets

Using Apigee's API BaaS, you can store and retrieve files and assets that hold data objects such as images, video, and audio content.

API BaaS manages these objects as Assets entities. Optionally, you can use Folder entities to organize related assets.

Uploading assets

Assets can be any file type and can be attached to any entity. When an asset is uploaded, API BaaS will automatically detect the file metadata for the asset and save it in the associated entity as a file-metadata property. Only 1 asset can be attached to an entity.

To attach an asset to an entity, do the following:

Request syntax

curl -X POST -F name='<filename>' -F file=@<file_location> 'https://<baas_host_name>/<org>/<app>/<collection>/<entity>'


Parameter Description
filename A filename to associate with the asset.
file_location The location of the asset to be uploaded. The @ symbol at the beginning is required for BaaS to auto-detect the file's content-type based on the file extension. If you don't include @, BaaS makes the content-type text/plain.
org Organization UUID or organization name
app Application UUID or application name
collection Name or UUID of the collection of the entity you want to attach the asset to.
entity Name or UUID of an existing entity you want to attach the asset to.

Example request

curl -X POST -i -F name='clouds' -F file=@happy_clouds.jpg 'https://<baas_host_name>/your-org/your-app/pictures/'

Example response

Notice the file-metadata property in the response.

    "action" : "post",
	"application" : "f34f4222-a166-11e2-a7f7-02e81adcf3d0",
	"params" : { },
	"path" : "/users",
	"uri" : "https://<baas_host_name>/amuramoto/sandbox/pictures",
	"entities" : [ {
	    "uuid" : "410b213a-b379-11e3-a0e5-9953085ea376",
	    "type" : "user",
	    "name" : "test",
	    "created" : 1395681911491,
	    "modified" : 1399069838919,
	    "name" : "clouds",    
	    "file" : "fobnszewobnioerabnoiawegbrn\n",
	    "file-metadata" : {
	        "content-type" : "image/jpeg",
	        "etag" : "\"2e1db7299b0a667ed80e674a0ef9d653\"",
	        "last-modified" : 1399070010115,
	        "content-length" : 28,
	        "checksum" : "2e1db7299b0a667ed80e674a0ef9d653"
	"metadata" : {
	  "connecting" : {        
	    "likes" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/connecting/likes"
	  "path" : "/users/410b213a-b379-11e3-a0e5-9953085ea376",
	  "sets" : {
	    "rolenames" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/roles",
	    "permissions" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/permissions"
	  "connections" : {
	    "follows" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/follows"
	  "collections" : {
	    "activities" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/activities",
	    "devices" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/devices",
	    "feed" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/feed",
	    "groups" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/groups",
	    "roles" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/roles",
	    "following" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/following",
	    "followers" : "/users/410b213a-b379-11e3-a0e5-9953085ea376/followers"
	} ],
	"timestamp" : 1399070009986,
	"duration" : 441,
	"organization" : "your-org",
	"applicationName" : "your-app"

Updating assets

To update the data for an asset, perform the same request outlined above in 'Uploading assets' as a PUT request rather than a POST.

Configuring shared storage of assets for API BaaS for the Private Cloud

Edge on-premises installation only.

In a Private Cloud installation of API BaaS, you should configure all API BaaS Stack nodes to use shared storage so that all assets are available to all API BaaS Stack nodes. Without shared storage, each BaaS Stack node has its own local copy of asset files and the nodes would not provide a consistent view of assets.

Configuring shared storage is required when:

  • You are using shared assets as described above.
  • You have multiple API BaaS Stack nodes. 

By default, the API BaaS Stack nodes use the following location to store assets:


Therefore, you should mount your shared storage at that location. 

You can also specify a different location for assets by setting the usergrid-deployment_usergrid.temp.files property on each API BaaS Stack node:

  1. Open /<inst_root>/apigee/customer/application/ file in an editor. If the file does not exist, create it. 
  2. Set the following property in file:
  3. Save the file.
  4. Restart the API BaaS Stack node:
    > /<inst_root>/apigee/apigee-service/bin/apigee-service baas-usergrid restart
  5. Repeat on all API BaaS Stack nodes.

Help or comments?