This is an unofficial SDK for Piano API. So please do not contact Piano support with questions or concerns about this SDK. For any issues, please make an issue on GitHub.
Note: This package is incomplete and experimental. It supports only a few APIs for the moment. Please use it with the utmost care and attention.
npm install piano-sdk
You must have API Token (apiToken
) and Application ID (aid
) to send a requests.
Also, you must pick an API environment from the followings (See "Environments" section on this page for details):
us
au
- Australiaap
- Asia-Pacificeu
- Europesandbox
- Sandbox
The following example demonstrates fetching a user data which has uid: abcdefg
:
import Piano from "piano-sdk"
// Initialize SDK with your API Token and Application Id
const piano = new Piano({
aid: 'xxxxxxxxxx', // Your Application ID
apiToken: '', // Your API Token
environment: 'us', // API environment
});
(async () => {
try {
const result = await piano.publisher.user.get({ uid: "abcdefg" });
console.log(result);
} catch (e) {
console.log(e);
}
})();
Or if you want to update that user:
(async () => {
try {
const result = await piano.publisher.user.update({
uid: "abcdefg",
email: "[email protected]",
first_name: "Foo"
});
} catch (e) {
console.log(e);
}
})();