This is a sample action code for SVF Cloud integration.
// Access token acquisitionconst elapse_sec = 300;const exp = Math.trunc(Date.now() / 1000) + elapse_sec;const { token } = await $fn.svf.oauth2.token({ exp: exp, sub: "xxxx@api.svfcloud.com", userName: "John D"}); // Print data creation/displayawait $fn.svf.artifacts.print({ token: token, name: "Invoice ", printer: "PDF", source: "CSV", defaultForm: "form/Sales/invoice.xml", // Display on client side redirect: true, data: { name: "Invoice", // Place CSV data files in a predetermined path in S3 csvFile: "/data/tokyo.csv" }}); // ※warning// If you use redirect,// token will not be destroyed($fn.svf.oauth2.revoke)
// Access token acquisitionconst elapse_sec = 300;const exp = Math.trunc(Date.now() / 1000) + elapse_sec;const { token } = await $fn.svf.oauth2.token({ exp: exp, sub: "xxxx@api.svfcloud.com", userName: "John D"}); // Printing Data Creationconst { artifactId, actionId, ticket } = await $fn.svf.artifacts.print({ token: token, name: "Tokyo Sales", printer: "PDF", source: "CSV", defaultForm: "form/Sales/sales.xml", redirect: false, data: { name: "Tokyo Sales", // Place CSV data files in a predetermined path in S3 csvFile: "/data/tokyo.csv" }}); // Save print data to fileawait $fn.svf.artifacts.download({ token: token, artifactId: artifactId, actionId: actionId, ticket: ticket, // Specify destination S3 file path file: "/pdfs/tokyo.pdf"}); // Access token destructionawait $fn.svf.oauth2.revoke({ token: token });