Particle API JS (Javascript SDK)
ParticleJS is JavaScript library for the Particle Device Cloud API for Node.js and the browser. It's open source so you can edit, change or even send in pull requests if you want to share!
This page contains examples to get started using the library.
For more details, see the detailed reference below and check the examples folder on GitHub.
Installation
Node.js
First, make sure you have node.js installed!
Next, open a command prompt or terminal, and install by typing:
$ npm install particle-api-js
Browser
Particle API JS can be included using bower:
$ bower install particle-api-js
Alternately, you can pull in Particle API JS from the JSDelivr and simply include the script in your HTML.
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/particle-api-js@10/dist/particle.min.js">
</script>
Now you will have a Particle object available that you can use in your application.
Responses
All functions in this library return promises.
particle.login({username: 'email@example.com', password: 'pass'}).then(
function(data){
console.log('API call completed on promise resolve: ', data.body.access_token);
},
function(err) {
console.log('API call completed on promise fail: ', err);
}
);
Examples
Here are some common use cases of using the functions in the Javascript library.
Logging in
login
You can create an account here. Use the token from login as the auth parameter in other calls.
var Particle = require('particle-api-js');
var particle = new Particle();
var token;
particle.login({username: 'user@email.com', password: 'pass'}).then(
function(data) {
token = data.body.access_token;
},
function (err) {
console.log('Could not log in.', err);
}
);
Device management
listDevices
List devices for a user with listDevices.
var token; // from result of particle.login
var devicesPr = particle.listDevices({ auth: token });
devicesPr.then(
function(devices){
console.log('Devices: ', devices);
},
function(err) {
console.log('List devices call failed: ', err);
}
);
callFunction
Call a function in device with callFunction.
var fnPr = particle.callFunction({ deviceId: 'DEVICE_ID', name: 'brew', argument: 'D0:HIGH', auth: token });
fnPr.then(
function(data) {
console.log('Function called succesfully:', data);
}, function(err) {
console.log('An error occurred:', err);
});
The function needs to be defined in the firmware uploaded to the device and registered to the Particle cloud.
You pass along the name of the function and the params.
If the function call succeeds, data.return_value is the value returned by the function call on the Particle device.
claimDevice
Claims device and adds it to the user account with claimDevice
particle.claimDevice({ deviceId: 'DEVICE_ID', auth: token }).then(function(data) {
console.log('device claim data:', data);
}, function(err) {
console.log('device claim err:', err);
});
flashDevice
Flash firmware to device with flashDevice
particle.flashDevice({ deviceId: 'DEVICE_ID', files: { file1: './path/file1' }, auth: token }).then(function(data) {
console.log('Device flashing started successfully:', data);
}, function(err) {
console.log('An error occurred while flashing the device:', err);
});
getDevice
Gets all attributes for the device with getDevice
var devicesPr = particle.getDevice({ deviceId: 'DEVICE_ID', auth: token });
devicesPr.then(
function(data){
console.log('Device attrs retrieved successfully:', data);
},
function(err) {
console.log('API call failed: ', err);
}
);
getVariable
Gets a variable value for the device with getVariable
particle.getVariable({ deviceId: 'DEVICE_ID', name: 'temp', auth: token }).then(function(data) {
console.log('Device variable retrieved successfully:', data);
}, function(err) {
console.log('An error occurred while getting attrs:', err);
});
The variable needs to be defined in your device's code.
If getting the variable succeeds, data.body.result is the value of the variable on the Particle device.
removeDevice
Removes device from the user account with removeDevice
particle.removeDevice({ deviceId: 'DEVICE_ID', auth: token }).then(function(data) {
console.log('remove call response:', data);
}, function(err) {
console.log('An error occurred while removing:', err);
});
renameDevice
Renames device for the user account with renameDevice
particle.renameDevice({ deviceId: 'DEVICE_ID', name: 'new-name', auth: token }).then(function(data) {
console.log('Device renamed successfully:', data);
}, function(err) {
console.log('An error occurred while renaming device:', err);
});
signalDevice
Send a signal to the device to shout rainbows with signalDevice
particle.signalDevice({ deviceId: 'DEVICE_ID', signal: true, auth: token }).then(function(data) {
console.log('Device is shouting rainbows:', data);
}, function(err) {
console.log('Error sending a signal to the device:', err);
});
Send a signal to the device to stop shouting rainbows
particle.signalDevice({ deviceId: 'DEVICE_ID', signal: false, auth: token }).then(function(data) {
console.log('The LED is back to normal:', data);
}, function(err) {
console.log('Error sending a signal to the device:', err);
});
sendPublicKey
Send public key for a device to the cloud with sendPublicKey
particle.sendPublicKey({ deviceId: 'DEVICE_ID', key: 'key', auth: token }).then(function(data) {
console.log('Public key sent successfully:', data);
}, function(err) {
console.log('Error sending public key to the device:', err);
});
getEventStream
Get event listener to an stream in the Particle cloud with getEventStream
//Get events filtered by name
particle.getEventStream({ name: 'x', auth: token}).then(function(stream) {
stream.on('event', function(data) {
console.log("Event: ", data);
});
});
//Get your devices events
particle.getEventStream({ deviceId: 'mine', auth: token }).then(function(stream) {
stream.on('event', function(data) {
console.log("Event: ", data);
});
});
//Get test event for specific device
particle.getEventStream({ deviceId: 'DEVICE_ID', name: 'test', auth: token }).then(function(stream) {
stream.on('event', function(data) {
console.log("Event: ", data);
});
});
data is an object with the following properties
{
"name":"Uptime",
"data":"5:28:54",
"ttl":"60",
"published_at":"2014-MM-DDTHH:mm:ss.000Z",
"coreid":"012345678901234567890123"
}
When a network error occurs or the event stream has not received a heartbeat from the Particle API in 13 seconds, the event stream will disconnect and attempt to reconnect after 2 seconds. To customize the reconnection behavior, close the stream in the disconnect handler.
// This is not a functional reconnection implementation, only an illustration of the various events
let attempts = 10;
particle.getEventStream(options).then(function(stream) {
stream.on('disconnect', function() {
console.log('Disconnected from Particle event stream');
attempts--;
if (attempts <= 0) {
console.log('Giving up reconnecting');
stream.abort();
}
});
stream.on('reconnect', function() {
console.log('Attempting to reconnect to Particle event stream');
});
stream.on('reconnect-success', function() {
console.log('Reconnected to Particle event stream');
attempts = 10;
});
stream.on('reconnect-error', function(error) {
console.log('Failed to reconnect to Particle event stream', error);
});
});
In case your event handler throws an exception, the error event will be emitted.
particle.getEventStream(options).then(function(stream) {
stream.on('event', function(data) {
throw new Error('oops');
});
stream.on('error', function(error) {
console.log('Error in handler', error);
});
});
publishEvent
Register an event stream in the Particle cloud with publishEvent
var publishEventPr = particle.publishEvent({ name: 'test', data: JSON.stringify({ ok: true }), auth: token });
publishEventPr.then(
function(data) {
if (data.body.ok) { console.log("Event published succesfully") }
},
function(err) {
console.log("Failed to publish event: " + err)
}
);
Working with code
compileCode
Compiles files in the Particle cloud with compileCode
var ccPr = particle.compileCode({ files: { 'main.cpp': './project/main.cpp', 'my_lib/lib.cpp': './project/my_lib/lib.cpp' }, auth: token });
ccPr.then(
function(data) {
console.log('Code compilation started successfully:', data);
}, function(err) {
console.log('An error occurred while compiling the code:', err);
});
Flashing
Flash firmware to a device with flashDevice
User management
createUser
Creates a user in the Particle cloud with createUser
particle.createUser({ username: 'example@email.com', password: 'pass' }).then(function(data) {
We try to login and get back an accessToken to verify user creation
var loginPromise = particle.login('example@email.com', 'pass');
We'll use promises to check the result of the login process
loginPromise.then(
function(data) {
console.log('Login successful! access_token:', data.access_token);
},
function(err) {
console.log('Login failed:', err);
}
);
}
});
listAccessTokens
Lists access tokens from the Particle cloud for the specified user with listAccessTokens
particle.listAccessTokens({ username: 'u@m.com', password: 'pass' }).then(function(data) {
console.log('data on listing access tokens: ', data);
}, function(err) {
console.log('error on listing access tokens: ', err);
});
deleteAccessToken
Removes an access token from the Particle cloud for the specified user with deleteAccessToken
particle.deleteAccessToken({ username: 'u@m.com', password: 'pass', token: 'token' }).then(function(data) {
console.log('data on deleting accessToken: ', data);
}, function(err) {
console.log('error on deleting accessToken: ', err);
});
Product support
If you are a product creator you can use the Javascript library to manage devices, firmware, integrations, and more.
Many of the functions in the Javascript library accept a product parameter. Pass your product ID number (such as 4567) or the slug (such as myproduct-v100) to make that function act on that product.
Detailed reference
Here a full reference of every function available in the Javascript client library.
constructor
Defined in: Particle.ts:86
Contructor for the Cloud API wrapper.
Create a new Particle object and call methods below on it.
Parameters
options?Options for this API call Options to be used for all requests (see Defaults)baseUrl?stringclientId?stringclientSecret?stringtokenDuration?numberauth?stringThe access token. If not specified here, will have to be added to every request
Returns Particle
login
Defined in: Particle.ts:142
Login to Particle Cloud using an existing Particle acccount.
Parameters
optionsLoginOptionsOptions for this API call
Returns Promise<JSONResponse<LoginResponse>> A promise that resolves with the response data
sendOtp
Defined in: Particle.ts:168
If login failed with an 'mfa_required' error, this must be called with a valid OTP code to login
Parameters
optionsSendOtpOptionsOptions for this API call
Returns Promise<JSONResponse<LoginResponse>> A promise that resolves with the response data
enableMfa
Defined in: Particle.ts:192
Enable MFA on the currently logged in user
Parameters
optionsEnableMfaOptionsOptions for this API call
Returns Promise<JSONResponse<EnableMfaResponse>> A promise that resolves with the response data
confirmMfa
Defined in: Particle.ts:207
Confirm MFA for the user. This must be called with current TOTP code, determined from the results of enableMfa(). You will be prompted to enter an OTP code every time you login after enrollment is confirmed.
Parameters
optionsConfirmMfaOptionsOptions for this API call
Returns Promise<JSONResponse<ConfirmMfaResponse>> A promise that resolves with the response data
disableMfa
Defined in: Particle.ts:232
Disable MFA for the user.
Parameters
optionsDisableMfaOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
createCustomer
Defined in: Particle.ts:252
Create Customer for Product.
Parameters
optionsCreateCustomerOptionsOptions for this API call
Returns Promise<JSONResponse<CreateCustomerResponse>> A promise that resolves with the response data
loginAsClientOwner
Defined in: Particle.ts:275
Login to Particle Cloud using an OAuth client.
Parameters
options?LoginAsClientOwnerOptions={}Options for this API call
Returns Promise<JSONResponse<LoginResponse>> A promise that resolves with the response data
createUser
Defined in: Particle.ts:300
Create a user account for the Particle Cloud
Parameters
optionsOptions for this API callusernamestringEmail of the new userpasswordstringPasswordaccountInfo?Record<string,string|number|boolean> Object that contains account information fields such as user real name, company name, business account flag etcutm?Record<string,string> Object that contains info about the campaign that lead to this user creationheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
resetPassword
Defined in: Particle.ts:322
Send reset password email for a Particle Cloud user account
Parameters
optionsResetPasswordOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
deleteAccessToken
Defined in: Particle.ts:339
Revoke an access token
Parameters
optionsDeleteAccessTokenOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
deleteCurrentAccessToken
Defined in: Particle.ts:355
Revoke the current session access token
Parameters
optionsDeleteCurrentAccessTokenOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
deleteActiveAccessTokens
Defined in: Particle.ts:372
Revoke all active access tokens
Parameters
optionsDeleteActiveAccessTokensOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
deleteUser
Defined in: Particle.ts:390
Delete the current user
Parameters
optionsDeleteUserOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
trackingIdentity
Defined in: Particle.ts:410
Retrieves the information that is used to identify the current login for tracking.
Parameters
options?TrackingIdentityOptions={}Options for this API call
Returns Promise<JSONResponse<TrackingIdentityResponse>> A promise that resolves with the response data
listDevices
Defined in: Particle.ts:436
List devices claimed to the account or product
Parameters
optionsOptions for this API calldeviceId?string(Product only) Filter results to devices with this ID (partial matching)deviceName?string(Product only) Filter results to devices with this name (partial matching)groups?string[] (Product only) A list of full group names to filter results to devices belonging to these groups only.sortAttr?string(Product only) The attribute by which to sort results. See API docs for options.sortDir?string(Product only) The direction of sorting. See API docs for options.page?number(Product only) Current page of resultsperPage?number(Product only) Records per pageproduct?string|numberList devices in this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<DeviceInfo[]>> A promise that resolves with the response data
getDevice
Defined in: Particle.ts:468
Get detailed informationa about a device
Parameters
optionsGetDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
claimDevice
Defined in: Particle.ts:483
Claim a device to the account. The device must be online and unclaimed.
Parameters
optionsClaimDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<ClaimResponse>> A promise that resolves with the response data
addDeviceToProduct
Defined in: Particle.ts:508
Add a device to a product or move device out of quarantine.
Parameters
optionsAddDeviceToProductOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
removeDevice
Defined in: Particle.ts:540
Unclaim / Remove a device from your account or product, or deny quarantine
Parameters
optionsRemoveDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
removeDeviceOwner
Defined in: Particle.ts:556
Unclaim a product device its the owner, but keep it in the product
Parameters
optionsRemoveDeviceOwnerOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
renameDevice
Defined in: Particle.ts:572
Rename a device
Parameters
optionsRenameDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
signalDevice
Defined in: Particle.ts:587
Instruct the device to turn on/off the LED in a rainbow pattern
Parameters
optionsSignalDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
setDeviceNotes
Defined in: Particle.ts:602
Store some notes about device
Parameters
optionsOptions for this API calldeviceIdstringDevice ID or NamenotesstringYour notes about this deviceproduct?string|numberDevice in this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
markAsDevelopmentDevice
Defined in: Particle.ts:617
Mark device as being used in development of a product so it opts out of automatic firmware updates
Parameters
optionsOptions for this API calldeviceIdstringDevice ID or Namedevelopment?boolean=trueSet to true to mark as development, false to return to product fleetproductstring|numberDevice in this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
lockDeviceProductFirmware
Defined in: Particle.ts:633
Mark device as being used in development of a product, so it opts out of automatic firmware updates
Parameters
optionsOptions for this API calldeviceIdstringDevice ID or NamedesiredFirmwareVersionnumberLock the product device to run this firmware version.flash?booleanImmediately flash firmware indicated by desiredFirmwareVersionproductstring|numberDevice in this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
unlockDeviceProductFirmware
Defined in: Particle.ts:647
Mark device as receiving automatic firmware updates
Parameters
optionsOptions for this API calldeviceIdstringDevice ID or Nameproductstring|numberDevice in this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
updateDevice
Defined in: Particle.ts:668
Update multiple device attributes at the same time
Parameters
optionsUpdateDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
unprotectDevice
Defined in: Particle.ts:700
Disable device protection.
Parameters
optionsUnprotectDeviceOptionsOptions for this API call.
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
provisionDevice
Defined in: Particle.ts:727
Provision a new device for products that allow self-provisioning
Parameters
optionsProvisionDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo>> A promise that resolves with the response data
getClaimCode
Defined in: Particle.ts:749
Generate a claim code to use in the device claiming process. To generate a claim code for a product, the access token MUST belong to a customer of the product.
Parameters
optionsGetClaimCodeOptionsOptions for this API call
Returns Promise<JSONResponse<ClaimCodeResponse>> A promise that resolves with the response data
getVariable
Defined in: Particle.ts:765
Get the value of a device variable
Parameters
optionsGetVariableOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceVariableResponse>> A promise that resolves with the response data
flashDevice
Defined in: Particle.ts:785
Compile and flash application firmware to a device. Pass a pre-compiled binary to flash it directly to the device.
Parameters
optionsFlashDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
compileCode
Defined in: Particle.ts:809
Compile firmware using the Particle Cloud
Parameters
optionsCompileCodeOptionsOptions for this API call
Returns Promise<JSONResponse<CompileResponse>> A promise that resolves with the response data
downloadFirmwareBinary
Defined in: Particle.ts:838
Download a firmware binary
Parameters
optionsDownloadFirmwareBinaryOptionsOptions for this API call
Returns Promise<Buffer | ArrayBuffer> A promise that resolves with the binary data
sendPublicKey
Defined in: Particle.ts:860
Send a new device public key to the Particle Cloud
Parameters
optionsOptions for this API calldeviceIdstringDevice ID or Namekeystring|BufferPublic key contentsalgorithm?stringAlgorithm used to generate the public key. Valid values arersaorecc.auth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
callFunction
Defined in: Particle.ts:888
Call a device function
Parameters
optionsCallFunctionOptionsOptions for this API call
Returns Promise<JSONResponse<FunctionCallResponse>> A promise that resolves with the response data
getEventStream
Defined in: Particle.ts:906
Get a stream of events
Parameters
optionsGetEventStreamOptionsOptions for this API call
Returns Promise<EventStream> A promise that resolves with the response data emit 'event' events.
publishEvent
Defined in: Particle.ts:945
Publish a event to the Particle Cloud
Parameters
optionsOptions for this API callnamestringEvent namedata?stringEvent dataisPrivate?booleanShould the event be publicly available?product?string|numberEvent for this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
Hook
Defined in: Particle.ts:940
Type: Object
Properties
methodstring(optional, defaultPOST) Type of web request triggered by the Webhook (GET, POST, PUT, or DELETE)authobject(optional) Auth data like{ user: 'me', pass: '1234' }for basic auth or{ bearer: 'token' }to send with the Webhook requestheadersobject(optional) Additional headers to add to the Webhook like{ 'X-ONE': '1', X-TWO: '2' }queryobject(optional) Query params to add to the Webhook request like{ foo: 'foo', bar: 'bar' }jsonobject(optional) JSON data to send with the Webhook request - setsContent-Typetoapplication/jsonformobject(optional) Form data to send with the Webhook request - setsContent-Typetoapplication/x-www-form-urlencodedbodystring(optional) Custom body to send with the Webhook requestresponseTemplateobject(optional) Template to use to customize the Webhook response bodyresponseEventobject(optional) The Webhook response event name that your devices can subscribe toerrorResponseEventobject(optional) The Webhook error response event name that your devices can subscribe to
createWebhook
Defined in: Particle.ts:980
Create a webhook
Parameters
optionsOptions for this API calleventstringThe name of the Particle event that should trigger the WebhookurlstringThe web address that will be targeted when the Webhook is triggereddevice?stringTrigger Webhook only for this device ID or NamerejectUnauthorized?booleanSet tofalseto skip SSL certificate validation of the target URLnoDefaults?booleanDon't include default event data in the webhook requesthook?{method?:string;auth?:Record<string,string>;headers?:Record<string,string>;query?:Record<string,string>;json?:object;form?:object;body?:string;responseTemplate?:string;responseEvent?:string;errorResponseEvent?:string; } Webhook configuration settingshook.method?stringhook.auth?Record<string,string>hook.headers?Record<string,string>hook.query?Record<string,string>hook.json?objecthook.form?objecthook.body?stringhook.responseTemplate?stringhook.responseEvent?stringhook.errorResponseEvent?string
product?string|numberWebhook for this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<CreateWebhookResponse>> A promise that resolves with the response data
deleteWebhook
Defined in: Particle.ts:1014
Delete a webhook
Parameters
optionsDeleteWebhookOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listWebhooks
Defined in: Particle.ts:1028
List all webhooks owned by the account or product
Parameters
optionsListWebhooksOptionsOptions for this API call
Returns Promise<JSONResponse<WebhookInfo[]>> A promise that resolves with the response data
createIntegration
Defined in: Particle.ts:1048
Create an integration to send events to an external service
See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
Parameters
optionsCreateIntegrationOptionsOptions for this API call
Returns Promise<JSONResponse<IntegrationInfo>> A promise that resolves with the response data
editIntegration
Defined in: Particle.ts:1070
Edit an integration to send events to an external service
See the API docs for details https://docs.particle.io/reference/api/#integrations-webhooks-
Parameters
optionsEditIntegrationOptionsOptions for this API call
Returns Promise<JSONResponse<IntegrationInfo>> A promise that resolves with the response data
deleteIntegration
Defined in: Particle.ts:1087
Delete an integration to send events to an external service
Parameters
optionsDeleteIntegrationOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listIntegrations
Defined in: Particle.ts:1101
List all integrations owned by the account or product
Parameters
optionsListIntegrationsOptionsOptions for this API call
Returns Promise<JSONResponse<IntegrationInfo[]>> A promise that resolves with the response data
getUserInfo
Defined in: Particle.ts:1114
Get details about the current user
Parameters
optionsOptions for this API callauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<UserInfo>> A promise that resolves with the response data
setUserInfo
Defined in: Particle.ts:1127
Set details on the current user
Parameters
optionsOptions for this API callaccountInfo?Record<string,string|number|boolean> Set user's extended info fields (name, business account, company name, etc)auth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<UserInfo>> A promise that resolves with the response data
changeUsername
Defined in: Particle.ts:1143
Change username (i.e, email)
Parameters
optionsChangeUsernameOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
changeUserPassword
Defined in: Particle.ts:1164
Change user's password
Parameters
optionsChangeUserPasswordOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listSIMs
Defined in: Particle.ts:1188
List SIM cards owned by a user or product
Parameters
optionsListSIMsOptionsOptions for this API call
Returns Promise<JSONResponse<SimInfo[]>> A promise that resolves with the response data
getSIMDataUsage
Defined in: Particle.ts:1204
Get data usage for one SIM card for the current billing period
Parameters
optionsGetSIMDataUsageOptionsOptions for this API call
Returns Promise<JSONResponse<SimDataUsage>> A promise that resolves with the response data
getFleetDataUsage
Defined in: Particle.ts:1221
Get data usage for all SIM cards in a product the current billing period
Parameters
optionsGetFleetDataUsageOptionsOptions for this API call
Returns Promise<JSONResponse<SimDataUsage>> A promise that resolves with the response data
checkSIM
Defined in: Particle.ts:1239
Check SIM status
Parameters
optionsCheckSIMOptionsOptions for this API call
Returns Promise<JSONResponse<SimInfo>> A promise that resolves with the response data
activateSIM
Defined in: Particle.ts:1256
Activate and add SIM cards to an account or product
Parameters
optionsActivateSIMOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
deactivateSIM
Defined in: Particle.ts:1277
Deactivate a SIM card so it doesn't incur data usage in future months.
Parameters
optionsDeactivateSIMOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
reactivateSIM
Defined in: Particle.ts:1294
Reactivate a SIM card the was deactivated or unpause a SIM card that was automatically paused
Parameters
optionsReactivateSIMOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
updateSIM
Defined in: Particle.ts:1311
Update SIM card data limit
Parameters
optionsUpdateSIMOptionsOptions for this API call
Returns Promise<JSONResponse<SimInfo>> A promise that resolves with the response data
removeSIM
Defined in: Particle.ts:1327
Remove a SIM card from an account so it can be activated by a different account
Parameters
optionsRemoveSIMOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listBuildTargets
Defined in: Particle.ts:1341
List valid build targets to be used for compiling
Parameters
optionsListBuildTargetsOptionsOptions for this API call
Returns Promise<JSONResponse<BuildTargetsResponse>> A promise that resolves with the response data
listLibraries
Defined in: Particle.ts:1370
List firmware libraries
Parameters
optionsListLibrariesOptionsOptions for this API call
Returns Promise<JSONResponse<{ data: LibraryInfo[]; }>> A promise
getLibrary
Defined in: Particle.ts:1403
Get firmware library details
Parameters
optionsGetLibraryOptionsOptions for this API call
Returns Promise<JSONResponse<{ data: LibraryInfo; }>> A promise
getLibraryVersions
Defined in: Particle.ts:1424
Firmware library details for each version
Parameters
optionsGetLibraryVersionsOptionsOptions for this API call
Returns Promise<JSONResponse<{ data: LibraryInfo[]; }>> A promise
contributeLibrary
Defined in: Particle.ts:1444
Contribute a new library version from a compressed archive
Parameters
optionsContributeLibraryOptionsOptions for this API call
Returns Promise<JSONResponse<{ data: LibraryInfo; }>> A promise
publishLibrary
Defined in: Particle.ts:1468
Publish the latest version of a library to the public
Parameters
optionsPublishLibraryOptionsOptions for this API call
Returns Promise<JSONResponse<{ data: LibraryInfo; }>> A promise
deleteLibrary
Defined in: Particle.ts:1489
Delete one version of a library or an entire private library
Parameters
optionsDeleteLibraryOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
downloadFile
Defined in: Particle.ts:1507
Download an external file that may not be on the API
Parameters
optionsDownloadFileOptionsOptions for this API call
Returns Promise<Buffer | ArrayBuffer> A promise that resolves with the binary data
listOAuthClients
Defined in: Particle.ts:1520
List OAuth client created by the account
Parameters
optionsListOAuthClientsOptionsOptions for this API call
Returns Promise<JSONResponse<{ clients: OAuthClientInfo[]; }>> A promise
createOAuthClient
Defined in: Particle.ts:1538
Create an OAuth client
Parameters
optionsOptions for this API callnamestringName of the OAuth clienttypestringweb, installed or webredirect_uri?stringURL to redirect after OAuth flow. Only for type web.scope?Record<string,string> Limits what the access tokens created by this client can do.product?string|numberCreate client for this product ID or slugauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<OAuthClientInfo>> A promise that resolves with the response data
updateOAuthClient
Defined in: Particle.ts:1556
Update an OAuth client
Parameters
optionsUpdateOAuthClientOptionsOptions for this API call
Returns Promise<JSONResponse<OAuthClientInfo>> A promise that resolves with the response data
deleteOAuthClient
Defined in: Particle.ts:1572
Delete an OAuth client
Parameters
optionsDeleteOAuthClientOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listProducts
Defined in: Particle.ts:1585
List products the account has access to
Parameters
optionsListProductsOptionsOptions for this API call
Returns Promise<JSONResponse<{ products: ProductInfo[]; }>> A promise
getProduct
Defined in: Particle.ts:1598
Get detailed information about a product
Parameters
optionsGetProductOptionsOptions for this API call
Returns Promise<JSONResponse<{ product: ProductInfo; }>> A promise
listProductFirmware
Defined in: Particle.ts:1611
List product firmware versions
Parameters
optionsListProductFirmwareOptionsOptions for this API call
Returns Promise<JSONResponse<ProductFirmwareInfo[]>> A promise that resolves with the response data
uploadProductFirmware
Defined in: Particle.ts:1629
List product firmware versions
Parameters
optionsUploadProductFirmwareOptionsOptions for this API call
Returns Promise<JSONResponse<ProductFirmwareInfo>> A promise that resolves with the response data
getProductFirmware
Defined in: Particle.ts:1657
Get information about a product firmware version
Parameters
optionsGetProductFirmwareOptionsOptions for this API call
Returns Promise<JSONResponse<ProductFirmwareInfo>> A promise that resolves with the response data
updateProductFirmware
Defined in: Particle.ts:1678
Update information for a product firmware version
Parameters
optionsUpdateProductFirmwareOptionsOptions for this API call
Returns Promise<JSONResponse<ProductFirmwareInfo>> A promise that resolves with the response data
downloadProductFirmware
Defined in: Particle.ts:1693
Download a product firmware binary
Parameters
optionsDownloadProductFirmwareOptionsOptions for this API call
Returns Promise<Buffer | ArrayBuffer> A promise that resolves with the binary data
downloadManufacturingBackup
Defined in: Particle.ts:1713
Download a tachyon manufacturing backup files
Parameters
optionsDownloadManufacturingBackupOptionsOptions for this API call
Returns Promise<Buffer | ArrayBuffer> A promise that resolves with the binary data
releaseProductFirmware
Defined in: Particle.ts:1734
Release a product firmware version as the default version
Parameters
optionsReleaseFirmwareOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listTeamMembers
Defined in: Particle.ts:1748
List product team members
Parameters
optionsListTeamMembersOptionsOptions for this API call
Returns Promise<JSONResponse<TeamMember[]>> A promise that resolves with the response data
inviteTeamMember
Defined in: Particle.ts:1767
Invite Particle user to a product team
Parameters
optionsInviteTeamMemberOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
removeTeamMember
Defined in: Particle.ts:1787
Remove Particle user to a product team
Parameters
optionsRemoveTeamMemberOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
lookupSerialNumber
Defined in: Particle.ts:1805
Fetch details about a serial number
Parameters
optionsLookupSerialNumberOptionsOptions for this API call
Returns Promise<JSONResponse<SerialNumberResponse>> A promise that resolves with the response data
createMeshNetwork
Defined in: Particle.ts:1825
Create a mesh network
Parameters
optionsCreateMeshNetworkOptionsOptions for this API call
Returns Promise<JSONResponse<NetworkInfo>> A promise that resolves with the response data
removeMeshNetwork
Defined in: Particle.ts:1844
Remove a mesh network.
Parameters
optionsRemoveMeshNetworkOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listMeshNetworks
Defined in: Particle.ts:1858
List all mesh networks
Parameters
optionsListMeshNetworksOptionsOptions for this API call
Returns Promise<JSONResponse<NetworkInfo[]>> A promise that resolves with the response data
getMeshNetwork
Defined in: Particle.ts:1872
Get information about a mesh network.
Parameters
optionsGetMeshNetworkOptionsOptions for this API call
Returns Promise<JSONResponse<NetworkInfo>> A promise that resolves with the response data
updateMeshNetwork
Defined in: Particle.ts:1887
Modify a mesh network.
Parameters
optionsUpdateMeshNetworkOptionsOptions for this API call
Returns Promise<JSONResponse<NetworkInfo>> A promise that resolves with the response data
addMeshNetworkDevice
Defined in: Particle.ts:1907
Add a device to a mesh network.
Parameters
optionsOptions for this API callnetworkIdstringNetwork ID or namedeviceIdstringDevice IDauth?stringThe access token. Can be ignored if provided in constructorheaders?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<NetworkInfo>> A promise that resolves with the response data
removeMeshNetworkDevice
Defined in: Particle.ts:1928
Remove a device from a mesh network.
Parameters
optionsRemoveMeshNetworkDeviceOptionsOptions for this API call
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listMeshNetworkDevices
Defined in: Particle.ts:1959
List all devices of a mesh network.
Parameters
optionsListMeshNetworkDevicesOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceInfo[]>> A promise that resolves with the response data
getProductConfiguration
Defined in: Particle.ts:1979
Get product configuration
Parameters
optionsGetProductConfigurationOptionsOptions for this API call
Returns Promise<JSONResponse<ProductConfigurationResponse>> A promise that resolves with the response data
getProductConfigurationSchema
Defined in: Particle.ts:1997
Get product configuration schema
Parameters
optionsGetProductConfigurationSchemaOptionsOptions for this API call
Returns Promise<JSONResponse<object>> A promise that resolves with the response data
getProductDeviceConfiguration
Defined in: Particle.ts:2017
Get product device's configuration
Parameters
optionsGetProductDeviceConfigurationOptionsOptions for this API call
Returns Promise<JSONResponse<ProductConfigurationResponse>> A promise that resolves with the response data
getProductDeviceConfigurationSchema
Defined in: Particle.ts:2036
Get product device's configuration schema
Parameters
optionsGetProductDeviceConfigurationSchemaOptionsOptions for this API call
Returns Promise<JSONResponse<object>> A promise that resolves with the response data
setProductConfiguration
Defined in: Particle.ts:2056
Set product configuration
Parameters
optionsSetProductConfigurationOptionsOptions for this API call
Returns Promise<JSONResponse<ProductConfigurationResponse>> A promise that resolves with the response data
setProductDeviceConfiguration
Defined in: Particle.ts:2077
Set product configuration for a specific device within the product
Parameters
optionsSetProductDeviceConfigurationOptionsOptions for this API call
Returns Promise<JSONResponse<ProductConfigurationResponse>> A promise that resolves with the response data
getProductLocations
Defined in: Particle.ts:2104
Query location for devices within a product
Parameters
optionsGetProductLocationsOptionsOptions for this API call
Returns Promise<JSONResponse<LocationListResponse>> A promise that resolves with the response data
getProductDeviceLocations
Defined in: Particle.ts:2138
Query location for one device within a product
Parameters
optionsGetProductDeviceLocationsOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceLocationInfo>> A promise that resolves with the response data
executeLogic
Defined in: Particle.ts:2166
Executes the provided logic function once and returns the result. No logs, runs, etc are saved
NOTE: Any external interactions such as Particle.publish will actually occur when the logic is executed.
Parameters
optionsExecuteLogicOptionsThe options for creating the logic function.
Returns Promise<JSONResponse<ExecuteLogicResponse>> A promise that resolves with the response data
createLogicFunction
Defined in: Particle.ts:2194
Creates a new logic function in the specified organization or sandbox using the provided function data.
When you create a logic function with Event logic triggers, events will immediately start being handled by the function code.
When you create a Scheduled logic trigger, it will immediately be scheduled at the next time according to the cron and start_at properties.
Parameters
optionsThe options for creating the logic function.auth?stringThe access token. Can be ignored if provided in constructororg?stringThe Organization ID or slug. If not provided, the request will go to your sandbox account.logicFunction{name:string;description?:string;enabled?:boolean;source: {type:"JavaScript";code:string; };logic_triggers?:object[];api_username?:string; } The logic function object containing the function details.logicFunction.namestringlogicFunction.description?stringlogicFunction.enabled?booleanlogicFunction.source{type:"JavaScript";code:string; }logicFunction.source.type"JavaScript"logicFunction.source.codestringlogicFunction.logic_triggers?object[]logicFunction.api_username?string
headers?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request contextcontext.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<{ logic_function: LogicFunction; }>> A promise that resolves to the created logic function data.
getLogicFunction
Defined in: Particle.ts:2216
Get a logic function in the specified organization or sandbox by logic function ID.
Parameters
optionsGetLogicFunctionOptionsThe options for the logic function.
Returns Promise<JSONResponse<{ logic_function: LogicFunction; }>> A promise that resolves to the specified logic function data.
updateLogicFunction
Defined in: Particle.ts:2240
Updates an existing logic function in the specified organization or sandbox using the provided function data.
If you include an id on a logic trigger, it will update the logic trigger in place.
Parameters
optionsThe options for updating the logic function.auth?stringThe access token. Can be ignored if provided in constructororg?stringThe Organization ID or slug. If not provided, the request will go to your sandbox account.logicFunctionIdstringThe ID of the logic function to update.logicFunction{name?:string;description?:string;enabled?:boolean;source?: {type:"JavaScript";code:string; };logic_triggers?:object[]; } The logic function object containing the logic function details.logicFunction.name?stringlogicFunction.description?stringlogicFunction.enabled?booleanlogicFunction.source?{type:"JavaScript";code:string; }logicFunction.source.type"JavaScript"logicFunction.source.codestringlogicFunction.logic_triggers?object[]
headers?Record<string,string> Key/Value pairs like{ 'X-FOO': 'foo', X-BAR: 'bar' }to send as headers.context?{tool?:ToolContext;project?:ProjectContext; } Request context.context.tool?ToolContextcontext.project?ProjectContext
Returns Promise<JSONResponse<{ logic_function: LogicFunction; }>> A promise that resolves to the updated logic function data.
deleteLogicFunction
Defined in: Particle.ts:2262
Deletes a logic function in the specified organization or sandbox by logic function ID.
Parameters
optionsDeleteLogicFunctionOptionsThe options for deleting the logic function.
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listLogicFunctions
Defined in: Particle.ts:2283
Lists all logic functions in the specified organization or sandbox.
Parameters
optionsListLogicFunctionsOptionsThe options for listing logic functions.
Returns Promise<JSONResponse<{ logic_functions: LogicFunction[]; }>> A promise that resolves to an array of logic functions data.
listLogicRuns
Defined in: Particle.ts:2307
Lists all logic runs for the specified logic function in the specified organization or sandbox.
Parameters
optionsListLogicRunsOptionsThe options for the request.
Returns Promise<JSONResponse<{ logic_runs: LogicRun[]; }>> A promise that resolves to an array of logic run data.
getLogicRun
Defined in: Particle.ts:2329
Retrieves a logic run by its ID for the specified logic function in the specified organization or sandbox.
Parameters
optionsGetLogicRunOptionsThe options for the request.
Returns Promise<JSONResponse<{ logic_run: LogicRun; }>> A promise that resolves to an array of logic run data for the specified logic run ID.
getLogicRunLogs
Defined in: Particle.ts:2351
Retrieves the logs for a logic run by its ID for the specified logic function in the specified organization or sandbox.
Parameters
optionsGetLogicRunLogsOptionsThe options for the request.
Returns Promise<JSONResponse<{ logs: LogicRunLog[]; }>> A promise that resolves to the logs for the specified logic run ID.
createLedger
Defined in: Particle.ts:2372
Creates a new ledger definition in the specified organization or sandbox.
Parameters
optionsCreateLedgerOptionsThe options for creating the ledger definition.
Returns Promise<JSONResponse<LedgerDefinition>> A promise that resolves with the response data
getLedger
Defined in: Particle.ts:2394
Get a ledger definition in the specified organization or sandbox by ledger name.
Parameters
optionsGetLedgerOptionsThe options for the ledger definition.
Returns Promise<JSONResponse<LedgerDefinition>> A promise that resolves with the response data
updateLedger
Defined in: Particle.ts:2416
Updates an existing ledger definition in the specified organization or sandbox.
Parameters
optionsUpdateLedgerOptionsThe options for updating the ledger definition.
Returns Promise<JSONResponse<LedgerDefinition>> A promise that resolves with the response data
archiveLedger
Defined in: Particle.ts:2438
Archives a ledger definition in the specified organization or sandbox by ledger name.
Parameters
optionsArchiveLedgerOptionsThe options for archiving the ledger definition.
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
Scope
Defined in: Particle.ts:2436
Type: "Owner" | "Product" | "Device"
listLedgers
Defined in: Particle.ts:2466
Lists all ledger definitions in the specified organization or sandbox.
Parameters
optionsListLedgersOptionsThe options for listing ledger definitions.
Returns Promise<JSONResponse<{ ledger_definitions: LedgerDefinition[]; }>> A promise that resolves to an array of ledger definition data.
getLedgerInstance
Defined in: Particle.ts:2494
Get ledger instance data.
Parameters
optionsGetLedgerInstanceOptionsThe options for the ledger instance.
Returns Promise<JSONResponse<LedgerInstance>> A promise that resolves with the response data
SetMode
Defined in: Particle.ts:2492
Type: "Replace" | "Merge"
setLedgerInstance
Defined in: Particle.ts:2522
Set ledger instance data.
Parameters
optionsSetLedgerInstanceOptionsThe options for updating the ledger instance.
Returns Promise<JSONResponse<LedgerInstance>> A promise that resolves with the response data
deleteLedgerInstance
Defined in: Particle.ts:2548
Delete a ledger instance in the specified organization or sandbox by ledger name.
Parameters
optionsDeleteLedgerInstanceOptionsThe options for archiving the ledger instance.
Returns Promise<JSONResponse<OKResponse>> A promise that resolves with the response data
listLedgerInstances
Defined in: Particle.ts:2571
Lists ledger instances in the specified organization or sandbox.
Parameters
optionsListLedgerInstancesOptionsThe options for listing ledger instances.
Returns Promise<JSONResponse<LedgerInstanceListResponse>> A promise that resolves with the response data
listLedgerInstanceVersions
Defined in: Particle.ts:2599
List ledger instance versions
Parameters
optionsListLedgerInstanceVersionsOptionsThe options for the ledger instance.
Returns Promise<JSONResponse<LedgerVersionListResponse>> A promise that resolves with the response data
getLedgerInstanceVersion
Defined in: Particle.ts:2626
Get specific ledger instance version
Parameters
optionsGetLedgerInstanceVersionOptionsThe options for the ledger instance.
Returns Promise<JSONResponse<LedgerInstance>> A promise that resolves with the response data
listDeviceOsVersions
Defined in: Particle.ts:2649
List Device OS versions
Parameters
optionsListDeviceOsVersionsOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceOsVersion[]>> A promise that resolves with the response data
getDeviceOsVersion
Defined in: Particle.ts:2678
Get a specific Device OS version
Parameters
optionsGetDeviceOsVersionOptionsOptions for this API call
Returns Promise<JSONResponse<DeviceOsVersion>> A promise that resolves with the response data
listEnvVars
Defined in: Particle.ts:2703
List environment variables for the given scope.
Parameters
optionsListEnvVarsOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsResponse>> A promise that resolves with the env vars data
updateEnvVars
Defined in: Particle.ts:2725
Bulk update environment variables with set/unset operations.
Parameters
optionsUpdateEnvVarsOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsResponse>> A promise that resolves with the updated env vars data
setEnvVar
Defined in: Particle.ts:2749
Set a single environment variable.
Parameters
optionsSetEnvVarOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsResponse>> A promise that resolves with the updated env vars data
deleteEnvVar
Defined in: Particle.ts:2772
Delete a single environment variable.
Parameters
optionsDeleteEnvVarOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsResponse>> A promise that resolves with the updated env vars data
renderEnvVars
Defined in: Particle.ts:2793
Get the rendered (flattened) environment variables for the given scope.
Parameters
optionsRenderEnvVarsOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsRenderResponse>> A promise that resolves with the rendered env vars
reviewEnvVarsRollout
Defined in: Particle.ts:2814
Review the pending environment variables rollout changes.
Parameters
optionsReviewEnvVarsRolloutOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsRolloutResponse>> A promise that resolves with the rollout diff
startEnvVarsRollout
Defined in: Particle.ts:2836
Start rolling out environment variables to devices.
Parameters
optionsStartEnvVarsRolloutOptionsOptions for this API call
Returns Promise<JSONResponse<EnvVarsRolloutStartResponse>> A promise that resolves with success status
setDefaultAuth
Defined in: Particle.ts:2849
Set default auth token that will be used in each method if auth is not provided
Parameters
authstringThe access token
Returns void
Throws
When not auth string is provided
get
get<
T>(params:GetHeadOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2906
Make a GET request
Type Parameters
T
T = object
Parameters
paramsGetHeadOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
head
head<
T>(params:GetHeadOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2922
Make a HEAD request
Type Parameters
T
T = object
Parameters
paramsGetHeadOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
post
post<
T>(params:MutateOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2938
Make a POST request
Type Parameters
T
T = object
Parameters
paramsMutateOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
put
put<
T>(params:MutateOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2955
Make a PUT request
Type Parameters
T
T = object
Parameters
paramsMutateOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
patch
patch<
T>(params:MutateOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2971
Make a PATCH request
Type Parameters
T
T = object
Parameters
paramsMutateOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
delete
delete<
T>(params:MutateOptions):Promise<JSONResponse<T>>
Defined in: Particle.ts:2987
Make a DELETE request
Type Parameters
T
T = object
Parameters
paramsMutateOptions
Returns Promise<JSONResponse<T>> A promise that resolves with the response data
request
Defined in: Particle.ts:3008
Parameters
argsAgentRequestOptionsAn obj with all the possible request configurations
Returns Promise<RequestResponse> A promise that resolves with the response data