Built-in function
SVF Cloud Web API calls can use built-in functions. Built-in functions are provided in the following formats to provide the same functionality as the SVF Cloud Web API.
$fn.svf.{API type}.{API name}()
The common rules for interfaces are as follows:
Function type | Asynchronous function (returns Promise) |
---|---|
Argument | Object |
Return value | Object or None |
Exception occurence | HTTP response codes and error contents can be obtained from the error object. |
$fn.svf.oauth2.token()
Authentication - Retrieve access tokens
パラメータ
name | type | require | description |
---|---|---|---|
sub | string | 〇 | User ID |
exp | number | 〇 | Expiration time |
userName | string | 〇 | User name |
timeZone | string | Time Zone | |
lang | string | Locale |
Return value
name | type | description |
---|---|---|
token | string | Access token |
expiration | number | Expiration |
Sample
[Action]
const results = await $fn.svf.oauth2.token({ exp: 1333685628, sub: "xxxx@api.svfcloud.com", userName: "John D", locale: "ja"});
[Return value]
{ token:"fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f", expiration:1442046911540}
$fn.svf.oauth2.revoke()
Authentication - Discard access tokens
Parameter
name | type | require | description |
---|---|---|---|
token | string | 〇 | access token |
Return value
None
Sample
[Action]
await $fn.svf.oauth2.revoke({ token: "fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f"});
$fn.svf.artifacts.print()
“Print” - Execute a print job Execute a print job
Parameter
name | type | require | description |
---|---|---|---|
token | string | 〇 | access token |
name | string | deliverable name | |
printer | string | 〇 | |
source | string | 〇 | data type |
defaultForm | string | form file path | |
data | object | 〇 | CSV data |
timeout | number | timeout time (seconds) | |
resource | object[] | resource data | |
password | string | password | |
pdfPermPass | string | authorization password | |
pdfPermPrint | string | PDF printing permission | |
pdfPermModify | string | PDF change permission | |
pdfPermCopy | boolean | PDF copy permission | |
redirect | boolean | redirect action | |
useEudc | boolean | use of EUDC | |
adjust | string | repositioning | |
defaultSvfEncode | string | default SVF encoding |
Parameter Supplemental Explanation
[data]
Type | object | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Properties |
|
||||||||||||||||
Supplementary explanation | - Either csvString/csvFileis required (csvString takes precedence if both are specified) - If multibyte characters are used for name, UTF-8 encoding is required. |
||||||||||||||||
Code Example |
data: {
|
[Resource]
Type | object[] | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Properties |
|
||||||||||||
Supplementary explanation | - Multiple resources can be specified - Limitations of "resource" parameter - Maximum file size of one image is 5 MB. - The total file size of images specified in the "resource" property is limited to 10 MB. |
||||||||||||
Code Example |
resource: [
|
Return value
name | type | description |
---|---|---|
artifactId | string | deliverable ID |
actionId | string | action ID |
ticket | string | one-time ticket |
Sample
[Action]
const csvdata = "ID,NAME,AMOUNT" + "\r\n" + "00001,Kant,150000" + "\r\n" + "00002,Heidegger,200000";
const results = await $fn.svf.artifacts.print({ token: "fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f", name: "Invoice", printer: "PDF", source: "CSV", defaultForm: "form/Sales/invoice.xml", data: { name: "Invoice", csvString: csvdata }});
[Return value]
{ artifactId: "411e2d3e-60c2-4f0d-9298-87e49b565b09", actionId: "0afc1417-e564-4274-b224-49aeed29e3b2", ticket: "18b2b4526cf8d3f7a6ecb1d23fed49f9602ab0d86acc272a7d49d52498cce33f"}
$fn.svf.artifacts.info()
“Print” - Retrieve artifact information
Parameter
name | type | require | description |
---|---|---|---|
token | string | 〇 | access token |
artifactId | string | 〇 | deliverable ID |
Return value
Returns in JavaScript object format according to “Retrieve artifact information – Response”.
Sample
[Action]
const results = await $fn.svf.artifacts.info({ token: "fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f", artifactId: "411e2d3e-60c2-4f0d-9298-87e49b565b09"});
$fn.svf.artifacts.download()
“Print” - Download artifacts
Parameter
name | type | require | description |
---|---|---|---|
token | string | 〇 | access token |
artifactId | string | 〇 | deliverable ID |
actionId | string | 〇 | action ID |
ticket | string | 〇 | one-time ticket |
file | string | 〇 | output file |
timeout | number | timeout time (seconds) |
Return value
None
Sample
[Action]
await $fn.svf.artifacts.download({ token: "fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f", artifactId: "411e2d3e-60c2-4f0d-9298-87e49b565b09" actionId: "0afc1417-e564-4274-b224-49aeed29e3b2", ticket: "18b2b4526cf8d3f7a6ecb1d23fed49f9602ab0d86acc272a7d49d52498cce33f", file: "/sales/2022_06.pdf", timeout: 60});
$fn.svf.actions.status()
“Print status” - Retrieve the print status
Parameter
name | type | require | description |
---|---|---|---|
token | string | 〇 | access token |
actionId | string | 〇 | action id |
Return value
Return in JavaScript object format according to retrieve the print status – response
Sample
[Action]
const results = await $fn.svf.actions.status({ token: "fa074d728eef1bfb1da897de1f64b53dae7857e87dd0b8b96d9f65e06da43e9f", actionId: "c31806dc-5f08-4aef-ab44-b03ce4a7a3a5"});