allow-file-control
Section: server
Default Value: false
Valid Values: true, false
Changes Take Effect: Immediately
True to enable the file upload control for the GMS Storage. Configure the list of supported mime files in the allowed-mime-types option. For additional details, refer to the GMS Storage API.
allowed-mime-types
Section: server
Default Value: Empty
Valid Values: String
Changes Take Effect: Immediately
Comma-separated list of mime types that GMS allows for storage. Refer to IANA Media Type Reference for a detailed list of possible mime types.
Storage API
Overview
The Storage API is a general purpose API that allows users to temporarily store arbitrary data. Data may consist of key/value pairs of strings or binary objects.
For security reasons, if you plan using the GMS Storage API, you can define a list of supported mime types in the allowed-mime-types option and configure allow-file-control = true to enable file control.
API
Create
Allows the creation of a new storage area in Genesys Mobile Services (GMS).
Starting 8.5.103.xx, this operation requires the gms_user header to be passed to associate the custom_id to the customer. To retrieve the stored value, you also need to pass the gms_user header.
Operation
Method | POST | ||
---|---|---|---|
URL | /genesys/1/storage/custom/{customId}/{ttl} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{customId} | string | yes | Custom ID of the storage. Available starting 8.5.103.xx |
{ttl} | number | yes | The time to live for this data, specified in seconds. The data is automatically deleted after it has been stored for {ttl} seconds. The ttl must be greater than zero (0). If an incorrect value is specified, a default of 30 seconds is defined. |
Body: A MultiPart form or a URL encoded form consisting of different items representing the key/value pairs to store. |
Response
A JSON object with the property id, identifying the assigned id for this storage request.
HTTP code | 200 |
---|---|
HTTP message | OK |
Example
The following example stores:
- Key1, Key2, Key3 and FileKey
The time-to-live of the data is 1 hour.
Operation
Request URL: http://localhost:8080/genesys/1/storage/3600 Request Method:POST Status Code:200 OK Request Headersview source Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:13028 Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryy16qocbN6tmPORZL Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/genesys/resources/storagetest.html User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 Request Payload ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="Key1" Value1 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="Key2" Value2 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="Key3" Value3 ------WebKitFormBoundaryy16qocbN6tmPORZL Content-Disposition: form-data; name="FileKey"; filename="MyPic.png" Content-Type: image/png ------WebKitFormBoundaryy16qocbN6tmPORZL--
Result
The above data is now stored up to 1 hour with an id of 39a98e24-b03b-4191-b756-1efe8f3b16b8.
HTTP 200 OK { "id":"39a98e24-b03b-4191-b756-1efe8f3b16b8" }
Update
Updates a storage area that has already been created in GMS.
Operation
Method | POST | ||
---|---|---|---|
URL | /genesys/1/storage/{id}/{ttl} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{id} | string | yes | The id of the allocated storage to be updated. |
{ttl} | number | yes | The time to live for this data, specified in seconds. The data is automatically deleted after it has been stored for {ttl} seconds. The ttl must be greater than zero (0). If an incorrect value is specified, a default of 30 seconds is defined. |
Body: A MultiPart form consisting of different items representing the key/value pairs to store. This may be string values or files. |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Example
The following example updates the keys:
- Key1, Key2, Key3 and FileKey
The time-to-live for all of the keys in this update is 1 hour.
Operation
Request URL: http://localhost:8080/genesys/1/stor age/b8e8eb60-3f14-493d-90da-0034aca34b55/3600 Request Method:POST Status Code:200 OK Request Headersview source Accept:*/* Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:171539 Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryPu8S1YopPtZq8Z54 Host:localhost:8080 Origin:http://localhost:8080 Referer:http://localhost:8080/genesys/resources/storagetest.html User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.77 Safari/535.7 Request Payload ------WebKitFormBoundaryPu8S1YopPtZq8Z54 Content-Disposition: form-data; name="Key1" Value6 ------WebKitFormBoundaryPu8S1YopPtZq8Z54 Content-Disposition: form-data; name="Key2" Value7 ------WebKitFormBoundaryPu8S1YopPtZq8Z54 Content-Disposition: form-data; name="Key3" Value8 ------WebKitFormBoundaryPu8S1YopPtZq8Z54 Content-Disposition: form-data; name="FileKey"; filename="0016_001.pdf" Content-Type: application/pdf ------WebKitFormBoundaryPu8S1YopPtZq8Z54-- Response Headersview source Cache-Control:no-cache no-store Content-Length:2 Content-Type:application/json Date:Sat, 04 Feb 2012 02:06:43 GMT Pragma:no-cache Server:Apache-Coyote/1.1
Result
The above data is now stored for up to 1 hour with an id of 39a98e24-b03b-4191-b756-1efe8f3b16b8.
HTTP 200 OK
Query (all keys)
Queries all of the keys in a storage area that has already been created in GMS.
Operation
Method | GET | ||
---|---|---|---|
URL | /genesys/1/storage/{id} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{id} | string | yes | The id of the allocated storage to be updated. |
Body: Not used |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Example
The following example queries all of the keys associated with id b8e8eb60-3f14-493d-90da-0034aca34b55
Operation
Request URL: http://localhost:8080/genesys/1/storage /b8e8eb60-3f14-493d-90da-0034aca34b55 Request Method:GET
Result
{"Key2":"Value7","Key1":"Value6","Key3":"Value8", "FileKey":"http://127.0.0.1:8080/genesys/1/storage/binary/ b8e8eb60-3f14-493d-90da-0034aca34b55/FileKey" }
Query (one key)
Queries one of the keys in a storage area that has already been created in GMS.
Operation
Method | GET | ||
---|---|---|---|
URL | /genesys/1/storage/{id}/{key} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{id} | string | yes | The id of the allocated storage to be updated. |
{key} | string | yes | The key of the specifically requested value |
Body: Not used |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Example
The following example queries the value of Key1 from the data associated with id b8e8eb60-3f14-493d-90da-0034aca34b55
Operation
Request URL: http://localhost:8080/genesys/1/storage /b8e8eb60-3f14-493d-90da-0034aca34b55/Key1 Request Method:GET
Result
Value1
Query (one binary key)
Queries one of the keys in a storage area that has already been created in GMS.
Operation
Method | GET | ||
---|---|---|---|
URL | /genesys/1/storage/binary/{id}/{key} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{id} | string | yes | The id of the allocated storage to be updated. |
{key} | string | yes | The key of the specifically requested value |
Body: Not used |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Body | The file that was stored for the specified key |
Example
The following example queries the value of Key1 from the data associated with id b8e8eb60-3f14-493d-90da-0034aca34b55
Operation
Request URL: http://localhost:8080/genesys/1/storage/binary /b8e8eb60-3f14-493d-90da-0034aca34b55/FileKey Request Method:GET
Delete
Deletes all of the keys in a storage area that has already been created in GMS.
Operation
Method | DELETE | ||
---|---|---|---|
URL | /genesys/1/storage/{id} | ||
Parameter | Type | Mandatory | Description |
URI Parameters | |||
{id} | string | yes | The id of the allocated storage to be deleted. |
Body: Not used |
Response
HTTP code | 200 |
---|---|
HTTP message | OK |
Example
The following example deletes all of the keys associated with id b8e8eb60-3f14-493d-90da-0034aca34b55
Operation
Request URL: http://localhost:8080/genesys/1/storage /b8e8eb60-3f14-493d-90da-0034aca34b55 Request Method:DELETE
Samples
Notes
Keys may not begin with an underscore (_).