A nodejs library which helps you consume Equinix Metal api routes.
For more info about the routes, please go to our Api's documentation
This repository is Experimental meaning that it's based on untested ideas or techniques and not yet established or finalized or involves a radically new and innovative style! This means that support is best effort (at best!) and we strongly encourage you to NOT use this in production.
npm install packet-nodejs
or git clone git@github.com:packethost/packet-nodejs.git
Packet = require('packet-nodejs');
var api = new Packet('YOU API TOKEN HERE');
//You can change your Token later on
api.setApiToken('YOUR NEW TOKEN');
- Projects
- Devices
- Facilities
- Operating Systems
- Plans
- Memberships
- Invitations
- Ips
- Transfers
- Users
- Events
- Notifications
- SSH Keys
- Emails
To make the documentation simpler and easier to read I'll put here comments on general variables that would otherwise make the documentation too long if put in every method:
- All the implemented methods take a callback function as the last parameter. This function accepts 2 parameters, error which is where an error will be if there was a problem with the request and body where you will find the data if there is any.
id
Project's ID.
project
Project object.
parameters
Parameters used for pagination and other filters, use false if you don't need anything.
user
User's ID or User's Email.
callback
Callback Function used to return the api's response.
Note: You can set id as false to get all the projects.
api.getProjects(id, parameters, callback);
api.addProject(project, callback);
api.updateProject(id, project, callback);
api.updateProject(id, callback);
api.transferProject(id, user, callback);
api.inviteToProject(id, user, callback);
api.requestIp(id, request, callback);
api.getProjectIpReservations(id, parameters, callback);
projectId
Project's ID.
id
Device's ID.
device
Device object.
parameters
Parameters used for pagination and other filters, use false if you don't need anything.
action
A valid action name. More Info
callback
Callback Function used to return the api's response.
Note: You can set id as false to get all the devices a project has.
api.getProjects(projectId, id, parameters, callback);
api.getDevices(projectId, device, callback);
api.updateDevice(id, device, callback);
api.removeDevice(id, callback);
api.deviceAction(id, action, callback);
api.assignIp(id, ip, callback);
api.getDeviceTraffic(id, parameters, callback);
callback
Callback Function used to return the api's response.
api.getLocations(callback);
callback
Callback Function used to return the api's response.
api.getOperatingSystems(callback);
callback
Callback Function used to return the api's response.
api.getPlans(callback);
id
Membership's ID.
membership
Membership object.
callback
Callback Function used to return the api's response.
api.getMembership(id, callback);
api.updateMembership(id, membership, callback);
api.removeMembership(id, callback);
id
Invitation's ID.
callback
Callback Function used to return the api's response.
api.getInvitation(id, callback);
api.acceptInvitation(id, callback);
api.removeInvitation(id, callback);
id
Ip's ID.
callback
Callback Function used to return the api's response.
api.getIp(id, callback);
api.removeIp(id, callback);
id
Membership's ID
callback
Callback Function used to return the api's response.
api.getTransfer(id, callback);
api.acceptTransfer(id, callback);
api.removeTransfer(id, callback);
user
User object
callback
Callback Function used to return the api's response.
api.getUser(callback);
api.updateCurrentUser(user, callback);
id
Event's ID
parameters
Parameters used for pagination and other filters, use false if you don't need anything.
callback
Callback Function used to return the api's response.
Note: Leaving id as false will return all the events for the current user.
api.getEvents(id, parameters, callback);
id
Notification's ID
parameters
Parameters used for pagination and other filters, use false if you don't need anything.
callback
Callback Function used to return the api's response.
Note: Leaving id as false will return all the notifications for the current user.
api.getNotifications(id, parameters, callback);
id
Notification's ID.
sshkey
SSH Key object.
callback
Callback Function used to return the api's response.
Note: Leaving id as false will return all the ssh keys for the current user.
api.getSshkeys(id, parameters, callback);
api.addSshkey(sshkey, callback);
api.updateSshkey(id, sshkey, callback);
api.removeSshkey(id, callback);
id
Notification's ID.
email
Email object.
callback
Callback Function used to return the api's response.
api.getEmail(id, callback);
api.addEmail(email, callback);
api.updateEmail(id, email, callback);
api.removeEmail(id, callback);