updating device 803480313004
{ uri:
'http://api-xmnup.lab.nordigy.ru/restapi/v1.0/account/225033004/device/803480313004',
id: '803480313004',
type: 'HardPhone',
sku: 'HP-52',
model: { id: '52', name: 'Cisco SPA-122 ATA', addons: [] },
name: 'Phone',
serial: 'HELL803480313004-225033004',
status: 'Offline',
extension:
{ uri:
'http://api-xmnup.lab.nordigy.ru/restapi/v1.0/account/225033004/extension/225033004',
id: 225033004,
extensionNumber: '101' },
phoneLines:
[ { lineType: 'Standalone',
emergencyAddress: [Object],
phoneInfo: [Object] } ],
emergencyServiceAddress:
{ street: '10th floor, Century Tower',
street2: 'No. 7, YiLan Road',
city: 'Xiamen',
state: 'Fujian',
country: 'CN',
countryId: '46',
countryIsoCode: 'CN',
countryName: 'China',
zip: '36000',
customerName: 'San Zhang' },
shipping:
{ address:
{ street: '123 Main St',
street2: 'Apt 4',
city: 'San Mateo',
state: 'CA',
stateId: '16',
stateIsoCode: 'CA',
stateName: 'California',
country: 'US',
countryId: '1',
countryIsoCode: 'US',
countryName: 'United States',
zip: '94404',
customerName: 'Something1 New1' },
method: { id: '1', name: 'Ground' },
status: 'Initial' },
linePooling: 'Host' }
Last active
November 22, 2018 04:11
-
-
Save tylerlong/ec13f0f1867deaee00d018c78d479f01 to your computer and use it in GitHub Desktop.
update device emergency address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RingCentral from 'ringcentral-js-concise' | |
const rc = new RingCentral( | |
process.env.RINGCENTRAL_CLIENT_ID, | |
process.env.RINGCENTRAL_CLIENT_SECRET, | |
process.env.RINGCENTRAL_SERVER_URL | |
) | |
;(async () => { | |
try { | |
await rc.authorize({ | |
username: process.env.RINGCENTRAL_USERNAME, | |
extension: process.env.RINGCENTRAL_EXTENSION, | |
password: process.env.RINGCENTRAL_PASSWORD | |
}) | |
let r = await rc.get('/restapi/v1.0/account/~/device') | |
const device = r.data.records.find(d => d.id === '803480313004') | |
console.log('updating device', device.id) | |
r = await rc.put('/restapi/v1.0/account/~/device/' + device.id, { | |
emergencyServiceAddress: { | |
customerName: 'San Zhang', | |
street: '10th floor, Century Tower', | |
street2: 'No. 7, YiLan Road', | |
city: 'Xiamen', | |
zip: '36000', | |
state: 'Fujian', | |
country: 'CN' | |
} | |
}) | |
console.log(r.data) | |
} finally { | |
await rc.revoke() | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment