1.2.4 ā¢ Published 4 years ago
panda_api_js v1.2.4
PandaDoc API Yarn Package
JS Wrapper for PandaDoc API
Installation
yarn add panda_api_js
Capabilities
Get Bearer Token
- Visit PandaDoc Developers Portal (https://developers.pandadoc.com/)
- Visit "My Applications" Tab
- Create PandaDoc Application (Application Name, Application Author, Redirect URI)
- Upon completion, you will receive a Client ID and Client Secret
- Install panda_api gem and instantiate the class
var panda = new PandaDoc("", "")
Get Code
panda.getCode({ client_id: <YOUR_CLIENT_ID>, client_secret: <YOUR_CLIENT_SECRET>, redirect_uri: <YOUR_REDIRECT_URI>, grant_type: "authorization_code", scope: "read+write" })
A browser tab will launch. If you are signed into PandaDoc, you authorize PandaDoc
- You will be redirected to your redirect_uri, with your code appended to the URL
https://myredirecturi.com/?state=&code=<YOUR_CODE_TO_PASTE>
- Copy the code. You are prompted to paste the code into your prompt
Your access token will be returned to you
{"access_token"=>"<YOUR_ACCESS_TOKEN>", "token_type"=>"Bearer", "expires_in"=>31535999, "scope"=>"read write read+write", "refresh_token"=>"<YOUR_REFRESH_TOKEN>ā}
Instantiate with API Key
Get API Key from Integrations Page on PandaDoc
- Instantiate new PandaDoc class instance
var panda = new PandaDoc(<YOUR_API_KEY>, "api")
You're Ready to go!
Refresh Oauth Token
var panda = new PandaDoc(<YOUR_BEARER_TOKEN>, "bearer") refresh_token = panda.refreshAccessToken({ client_id: <YOUR_CLIENT_ID>, client_secret: <YOUR_CLIENT_SECRET>, # your REFRESH TOKEN, NOT Access Token refresh_token: <YOUR_REFRESH_TOKEN>, scope: <read, write, read+write> })
Instance Methods
(https://developers.pandadoc.com/reference)
var panda = new PandaDoc(<YOUR_KEY>, <YOUR_KEY_TYPE>) # Documents Index (GET) panda.listDocuments({ <YOUR_PARAMS> }) # Templates Index (GET) panda.listTemplates({ <YOUR_PARAMS> }) # Document Details (GET) # Document ID Required panda.documentDetails({ <YOUR_PARAMS> }) # Document Status (GET) # Document ID Required panda.documentStatus({ <YOUR_PARAMS> }) # Template Details (GET) # Template ID Required panda.templateDetails({ YOUR_PARAMS }) # Create Document (PDF) (POST) var newDoc = panda.createDocumentFromPdf( # Valid File: File {<YOUR_FILE>} || params.files[0] file: <file_to_send>, name: "New PandaDoc Document from PDF", recipients: [ { email: "matt@example.com",first_name: "Matt",last_name: "sample",role: "u00"}], fields: <YOUR_FIELDS>, metadata: <YOUR_META>, parse_form_fields: false ).body # Create Document (Template) (POST) var newDoc = panda.createDocumentFromTemplate({ name: "New Doc From Template", template_uuid: "<YOUR_TEMPLATE_ID>", recipients: [{ first_name: "Balton", last_name: "Reign", email: "client@gmail.com" }], tokens: [{ name: "Client.FirstName", value: "Percy" }, { name: "Client.LastName", value: "Johnson" }], fields: <YOUR_FIELDS>, metadata: <YOUR_META> }) # Send Document (POST) panda.sendDocument({ id: <YOUR_DOC_ID>, message: <YOUR_MESSAGE>, subject: <YOUR_SUBJECT>, silent: true || false }) # Create Document Session ID (POST) panda.createDocumentLink({ id: <YOUR_DOC_ID>, recipient: <YOUR_RECIPIENT_EMAIL>, lifetime: 3600 }) # Download Document (GET) panda.downloadDocument({ id: <YOUR_DOC_ID> }) # Download Protected Document (GET) panda.downloadProtectedDocument({ id: <YOUR_DOC_ID> }) # Delete Document (DELETE) panda.deleteDocument({ id: <YOUR_DOC_ID> }) # Delete Template (DELETE) panda.deleteTemplate({ id: <YOUR_TEMP_ID> }) # Create Document Folder (POST) panda.createDocumentFolder({ name: "<YOUR_NEW_FOLDER_NAME>" }) # Create Template Folder (POST) panda.createTemplateFolder({ name: "<YOUR_NEW_FOLDER_NAME>" }) # List Template Folders (POST) panda.listTemplateFolders({ <YOUR_PARAMS> }) # List Document Folders (POST) panda.listDocumentFolders({ <YOUR_PARAMS> }) # Update Document Folder Name (PUT) panda.updateDocumentFolder({ <YOUR_PARAMS> }) # Update Template Folder Name (PUT) panda_doc_api.updateTemplateFolder({ YOUR_PARAMS })
Questions / Concerns
Please reach out directly to the author, matt.deatherage@pandadoc.com
1.2.0
4 years ago
1.1.9
4 years ago
1.1.8
4 years ago
1.1.7
4 years ago
1.2.4
4 years ago
1.1.5
4 years ago
1.2.3
4 years ago
1.1.4
4 years ago
1.2.2
4 years ago
1.1.3
4 years ago
1.2.1
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago