magicbooks-api
v1.0.4
Published
An npm package for interacting with the MagicBooks API
Downloads
46
Readme
magicbooks-api
An npm package for interacting with the MagicBooks API.
Installation
npm install magicbooks-api
Usage
// Import the magicbooks-api package
const magicBooksAPI = require('magicbooks-api');
// Define your application's credentials
const appId = 'developerAppId';
const apiKey = 'developerApiKey';
const bookId = '7NrxX9UTixWp9uzLfIH5';
// Call the createBookSessionLitebox function
magicBooksAPI.createBookSessionLitebox(appId, apiKey, bookId)
.then(html => {
// Insert the HTML markup into the document body
document.body.innerHTML = html;
})
.catch(error => {
// Handle any errors
console.error(error);
});
//html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My App</title>
</head>
<body>
<!-- Your HTML content here -->
<script src="app.js"></script>
</body>
</html>
API
createBookSession(appId, apiKey);
Creates a book session.
appId (string): Unique identifier for the developer's application created in magicbooks.io. apiKey (string): API key associated with the provided appId. Returns a Promise that resolves with the response data from the MagicBooks API.
License ISC License