This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getFormDataJob(source, token, clientId) { | |
let body = { | |
'assetID': source.assetID | |
} | |
let resp = await fetch('https://pdf-services-ue1.adobe.io/operation/getformdata', { | |
method: 'POST', | |
headers: { | |
'Authorization':`Bearer ${token}`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
status: 'done', | |
asset: { | |
metadata: { type: 'application/json', size: 175 }, | |
downloadUri: 'https://dcplatformstorageservice-prod-us-east-1.s3-accelerate.amazonaws.com/veryLongURL', | |
assetID: 'urn:aaid:AS:UE1:b21a15d6-1d24-429b-b550-143a52f6968c' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "result" is the data from the last check of the job url | |
let dataReq = await fetch(result.asset.downloadUri); | |
let data = await dataReq.json(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
option_two: 'Yes', | |
option_one: 'Off', | |
name: 'Raymond Camden', | |
option_three: 'Yes', | |
age: '51', | |
favorite_movie: 'The Empire Strikes Back' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
let REST_API = "https://pdf-services.adobe.io/"; | |
let CLIENT_ID = process.env.CLIENT_ID; | |
let CLIENT_SECRET = process.env.CLIENT_SECRET; | |
let SOURCE_PDF = './form2_filled.pdf'; | |
async function delay(x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
option_two: 'Yes or Off', | |
option_one: 'Yes or Off', | |
name: 'A name', | |
option_three: 'Yes or Off', | |
age: 'A number, but as a string', | |
favorite_movie: 'One of three movies' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function setFormDataJob(source, data, token, clientId) { | |
let body = { | |
'assetID': source.assetID, | |
'jsonFormFieldsData':data | |
} | |
let resp = await fetch('https://pdf-services-ue1.adobe.io/operation/setformdata', { | |
method: 'POST', | |
headers: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let input = [ | |
{ option_one: 'Yes', option_two: 'Off', option_three: 'Off', name: 'Jacob Smith', age: '90', favorite_movie: 'Star Wars' }, | |
{ option_one: 'Off', option_two: 'Off', option_three: 'Off', name: 'Zelda Camden', age: '12', favorite_movie: 'Star Wars Again' }, | |
{ option_one: 'Yes', option_two: 'Yes', option_three: 'Yes', name: 'Grace Undrapress', age: '45', favorite_movie: 'The Empire Strikes Back' }, | |
]; | |
let accessToken = await getAccessToken(CLIENT_ID, CLIENT_SECRET); | |
console.log('Got our access token.'); | |
let sourceAsset = await getUploadData('application/pdf', accessToken, CLIENT_ID); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import { Readable } from 'stream'; | |
import { finished } from 'stream/promises'; | |
let REST_API = "https://pdf-services.adobe.io/"; | |
let CLIENT_ID = process.env.CLIENT_ID; | |
let CLIENT_SECRET = process.env.CLIENT_SECRET; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
favorite_movie value lies outside the list values, setting custom text is not allowed; |
NewerOlder