Skip to contentSkip to navigationSkip to topbar
Rate this Page:

Sync MapItem Resource


A Sync MapItem is an individual item that belongs to one or more of your Sync Maps. See the full API reference documentation for the Sync Map resource here.

(information)

Info

You need to create a Map first before you can use this resource to create, read, update, and delete items.

Sync MapItems:

  • can be inserted, updated, removed and iterated
  • are limited to 16KB of data

Sync MapItem properties

sync-mapitem-properties page anchor
Resource properties
keytype: stringPII MTL: 30 days

The unique, user-defined key for the Map Item.


service_sidtype: SID<IS>Not PII

The SID of the Sync Service(link takes you to an external page) the resource is associated with.


map_sidtype: SID<MP>Not PII

The SID of the Sync Map that contains the Map Item.


urltype: string<URI>Not PII

The absolute URL of the Map Item resource.


revisiontype: stringNot PII

The current revision of the Map Item, represented as a string.


datatype: objectPII MTL: 7 days

An arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length.


date_expirestype: string<DATE TIME>Not PII

The date and time in GMT when the Map Item expires and will be deleted, specified in ISO 8601(link takes you to an external page) format. If the Map Item does not expire, this value is null. The Map Item might not be deleted immediately after it expires.


date_createdtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was created specified in ISO 8601(link takes you to an external page) format.


date_updatedtype: string<DATE TIME>Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601(link takes you to an external page) format.


created_bytype: stringPII MTL: 30 days

The identity of the Map Item's creator. If the Map Item is created from the client SDK, the value matches the Access Token's identity field. If the Map Item was created from the REST API, the value is system.


Create a MapItem resource

create-a-mapitem-resource page anchor
POST https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items

Parameters

create-parameters page anchor
URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) to create the Map Item in.


MapSidtype: stringNot PII
Path Parameter

The SID of the Sync Map to add the new Map Item to. Can be the Sync Map resource's sid or its unique_name.


Request body parameters
Keytype: stringPII MTL: 30 days
Required

The unique, user-defined key for the Map Item. Can be up to 320 characters long.


Datatype: objectPII MTL: 7 days
Required

A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length.


Ttltype: integerNot PII

An alias for item_ttl. If both parameters are provided, this value is ignored.


ItemTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Map Item expires (time-to-live) and is deleted.


CollectionTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Map Item's parent Sync Map expires (time-to-live) and is deleted.

Create a MapItem with the REST API

create-a-mapitem-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = require('twilio')(accountSid, authToken);
_16
_16
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMapItems
_16
.create({key: 'foo', data: {
_16
name: 'Foo Bar',
_16
level: 30,
_16
username: 'foo_bar'
_16
}})
_16
.then(sync_map_item => console.log(sync_map_item.key));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"created_by": "created_by",
_17
"data": {
_17
"name": "Foo Bar",
_17
"level": 30,
_17
"username": "foo_bar"
_17
},
_17
"date_expires": "2015-07-30T21:00:00Z",
_17
"date_created": "2015-07-30T20:00:00Z",
_17
"date_updated": "2015-07-30T20:00:00Z",
_17
"key": "foo",
_17
"map_sid": "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"revision": "revision",
_17
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key"
_17
}

Use the set method


_10
syncClient.map('users').then(function(map) {
_10
map.set('Taylor', {
_10
phone_number: 12345678,
_10
country: 'UK'
_10
}).then(function(item) {
_10
console.log('Added: ', item.key);
_10
}).catch(function(err) {
_10
console.error(err);
_10
});
_10
});

Please note: You can also use the set method to update data in existing JSON data in a Map. However, using set will overwrite any existing data in a MapItem.

Subscribe to a MapItem addition with the JavaScript SDK

subscribe-to-a-mapitem-addition-with-the-javascript-sdk page anchor

Note that there are two separate events for map item adds and map item updates:


_12
syncClient.map('users').then(function (map) {
_12
map.on('itemAdded', function(item) {
_12
console.log('key', item.key);
_12
console.log('JSON data', item.value);
_12
});
_12
_12
//Note that there are two separate events for map item adds and map item updates:
_12
map.on('itemUpdated', function(item) {
_12
console.log('key', item.key);
_12
console.log('JSON data', item.value);
_12
});
_12
});


Fetch a MapItem resource

fetch-a-mapitem-resource page anchor
GET https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync Map Item resource to fetch.


MapSidtype: stringNot PII
Path Parameter

The SID of the Sync Map with the Sync Map Item resource to fetch. Can be the Sync Map resource's sid or its unique_name.


Keytype: stringPII MTL: 30 days
Path Parameter

The key value of the Sync Map Item resource to fetch.

Fetch a MapItem with the REST API

fetch-a-mapitem-with-the-rest-api page anchor

Request a MapItem by the key you defined when you created the item

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMapItems('foo')
_12
.fetch()
_12
.then(sync_map_item => console.log(sync_map_item.key));

Output

_13
{
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"created_by": "created_by",
_13
"data": {},
_13
"date_expires": "2015-07-30T21:00:00Z",
_13
"date_created": "2015-07-30T20:00:00Z",
_13
"date_updated": "2015-07-30T20:00:00Z",
_13
"key": "foo",
_13
"map_sid": "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"revision": "revision",
_13
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key"
_13
}

Fetch a single MapItem with the JavaScript SDK

fetch-a-single-mapitem-with-the-javascript-sdk page anchor

Fetches by a specific key


_10
syncClient.map('users').then(function(map) {
_10
map.get('Taylor').then(function(item) {
_10
console.log(item.value);
_10
});
_10
});


Read all MapItem resources

read-all-mapitem-resources page anchor
GET https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items

MapItem read access is performed using the key that provided as an arbitrary string to identify the item.

(information)

Info

By default, this will return the first 50 MapItems. Supply a PageSize parameter to fetch up to 100 items at once. See paging for more information.

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Map Item resources to read.


MapSidtype: stringNot PII
Path Parameter

The SID of the Sync Map with the Sync Map Item resource to fetch. Can be the Sync Map resource's sid or its unique_name.


Ordertype: enum<STRING>Not PII
Query Parameter

How to order the Map Items returned by their key value. Can be: asc (ascending) or desc (descending) and the default is ascending. Map Items are ordered lexicographically(link takes you to an external page) by Item key.

Possible values:
ascdesc

Fromtype: stringNot PII
Query Parameter

The key of the first Sync Map Item resource to read. See also bounds.


Boundstype: enum<STRING>Not PII
Query Parameter

Whether to include the Map Item referenced by the from parameter. Can be: inclusive to include the Map Item referenced by the from parameter or exclusive to start with the next Map Item. The default value is inclusive.

Possible values:
inclusiveexclusive

PageSizetype: integerNot PII
Query Parameter

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integerNot PII
Query Parameter

The page index. This value is simply for client state.


PageTokentype: stringNot PII
Query Parameter

The page token. This is provided by the API.

Read all MapItems with the REST API

read-all-mapitems-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMapItems
_12
.list({limit: 20})
_12
.then(syncMapItems => syncMapItems.forEach(s => console.log(s.key)));

Output

_12
{
_12
"items": [],
_12
"meta": {
_12
"first_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0",
_12
"key": "items",
_12
"next_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=1",
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0",
_12
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0"
_12
}
_12
}

Read: Query a Map with filters with the REST API

read-query-a-map-with-filters-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_12
// Download the helper library from https://www.twilio.com/docs/node/install
_12
// Find your Account SID and Auth Token at twilio.com/console
_12
// and set the environment variables. See http://twil.io/secure
_12
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12
const authToken = process.env.TWILIO_AUTH_TOKEN;
_12
const client = require('twilio')(accountSid, authToken);
_12
_12
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12
.syncMapItems
_12
.list({from: 'foo', order: 'asc', limit: 20})
_12
.then(syncMapItems => syncMapItems.forEach(s => console.log(s.key)));

Output

_12
{
_12
"items": [],
_12
"meta": {
_12
"first_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0",
_12
"key": "items",
_12
"next_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=1",
_12
"page": 0,
_12
"page_size": 50,
_12
"previous_page_url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0",
_12
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items?From=from&Bounds=inclusive&Order=asc&PageSize=50&Page=0"
_12
}
_12
}

Get all MapItems with the JavaScript SDK

get-all-mapitems-with-the-javascript-sdk page anchor

This code sample displays the first item.


_10
syncClient.map('users').then(function(map) {
_10
map.getItems().then(function(page) {
_10
console.log('show first item', page.items[0].key,
_10
page.items[0].value);
_10
});
_10
});


Update a MapItem resource

update-a-mapitem-resource page anchor
POST https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}

MapItem update access is performed using the key that provided as an arbitrary string to identify the item.

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync Map Item resource to update.


MapSidtype: stringNot PII
Path Parameter

The SID of the Sync Map with the Sync Map Item resource to update. Can be the Sync Map resource's sid or its unique_name.


Keytype: stringPII MTL: 30 days
Path Parameter

The key value of the Sync Map Item resource to update.


If-Matchtype: stringNot PII
Header Parameter

If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP If-Match header(link takes you to an external page).


Request body parameters
Datatype: objectPII MTL: 7 days

A JSON string that represents an arbitrary, schema-less object that the Map Item stores. Can be up to 16 KiB in length.


Ttltype: integerNot PII

An alias for item_ttl. If both parameters are provided, this value is ignored.


ItemTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Map Item expires (time-to-live) and is deleted.


CollectionTtltype: integerNot PII

How long, in seconds(link takes you to an external page), before the Map Item's parent Sync Map expires (time-to-live) and is deleted. This parameter can only be used when the Map Item's data or ttl is updated in the same request.

Update a MapItem with the REST API

update-a-mapitem-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = require('twilio')(accountSid, authToken);
_16
_16
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMapItems('foo')
_16
.update({data: {
_16
name: 'FooBaz',
_16
level: 31,
_16
username: 'foo_baz'
_16
}})
_16
.then(sync_map_item => console.log(sync_map_item.key));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"created_by": "created_by",
_17
"data": {
_17
"name": "FooBaz",
_17
"level": 31,
_17
"username": "foo_baz"
_17
},
_17
"date_expires": "2015-07-30T21:00:00Z",
_17
"date_created": "2015-07-30T20:00:00Z",
_17
"date_updated": "2015-07-30T20:00:00Z",
_17
"key": "foo",
_17
"map_sid": "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"revision": "revision",
_17
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key"
_17
}

Update: Update a MapItem with Conflict Resolution with the REST API

update-update-a-mapitem-with-conflict-resolution-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = require('twilio')(accountSid, authToken);
_16
_16
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.syncMapItems('foo')
_16
.update({data: {
_16
name: 'FooBaz',
_16
level: 31,
_16
username: 'foo_baz'
_16
}, ifMatch: '1a'})
_16
.then(sync_map_item => console.log(sync_map_item.revision));

Output

_17
{
_17
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"created_by": "created_by",
_17
"data": {
_17
"name": "FooBaz",
_17
"level": 31,
_17
"username": "foo_baz"
_17
},
_17
"date_expires": "2015-07-30T21:00:00Z",
_17
"date_created": "2015-07-30T20:00:00Z",
_17
"date_updated": "2015-07-30T20:00:00Z",
_17
"key": "foo",
_17
"map_sid": "MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"revision": "revision",
_17
"service_sid": "ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_17
"url": "https://sync.twilio.com/v1/Services/ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Maps/MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Items/key"
_17
}

Update data in a MapItem with the JavaScript SDK

update-data-in-a-mapitem-with-the-javascript-sdk page anchor

Use the update method to change the data in a Map Item


_10
syncClient.map('users').then(function(map) {
_10
map.update('Taylor',{country: "IRL"});
_10
});

Mutate data in a MapItem using the JavaScript SDK

mutate-data-in-a-mapitem-using-the-javascript-sdk page anchor

Use mutate for more fine-grained control over updates.


_10
syncClient.map('users').then(function (map) {
_10
map.mutate('david',function(remoteData) {
_10
remoteData.country = "USA";
_10
return remoteData;
_10
});
_10
});

The mutate function helps your Javascript code respond to concurrent updates with versioned control. See the corresponding JavaScript SDK documentation for details.

Subscribe to a MapItem update with the JavaScript SDK

subscribe-to-a-mapitem-update-with-the-javascript-sdk page anchor

Note that there are two separate events for map item adds and map item updates:


_12
syncClient.map('users').then(function (map) {
_12
map.on('itemAdded', function(item) {
_12
console.log('key', item.key);
_12
console.log('JSON data', item.value);
_12
});
_12
_12
//Note that there are two separate events for map item adds and map item updates:
_12
map.on('itemUpdated', function(item) {
_12
console.log('key', item.key);
_12
console.log('JSON data', item.value);
_12
});
_12
});


Delete a MapItem resource

delete-a-mapitem-resource page anchor
DELETE https://sync.twilio.com/v1/Services/{ServiceSid}/Maps/{MapSid}/Items/{Key}

Permanently delete a specific item from an existing Map.

URI parameters
ServiceSidtype: stringNot PII
Path Parameter

The SID of the Sync Service(link takes you to an external page) with the Sync Map Item resource to delete.


MapSidtype: stringNot PII
Path Parameter

The SID of the Sync Map with the Sync Map Item resource to delete. Can be the Sync Map resource's sid or its unique_name.


Keytype: stringPII MTL: 30 days
Path Parameter

The key value of the Sync Map Item resource to delete.


If-Matchtype: stringNot PII
Header Parameter

If provided, applies this mutation if (and only if) the “revision” field of this [map item] matches the provided value. This matches the semantics of (and is implemented with) the HTTP If-Match header(link takes you to an external page).

Delete a MapItem with the REST API

delete-a-mapitem-with-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncMapItems('foo')
_11
.remove();

Delete: Delete a MapItem with Conflict Resolution using the REST API

delete-delete-a-mapitem-with-conflict-resolution-using-the-rest-api page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.sync.v1.services('ISXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncMaps('MPXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.syncMapItems('foo')
_11
.remove({ifMatch: '1a'});

Delete a single MapItem with the JavaScript SDK

delete-a-single-mapitem-with-the-javascript-sdk page anchor

Deletes the item with key 'Taylor'


_10
syncClient.map('users').then(function(map) {
_10
map.remove('Taylor').then(function() {
_10
console.log('item deleted');
_10
});
_10
});


Rate this Page: