POST https://example.com/documentprocessing/pdf/acroforms/fields
Description
Returns all AcroForm fields of a given PDF document.
Examples
The following example returns the form fields of a given PDF document.
curl --location --request POST 'https://trial.dsserver.io/documentprocessing/pdf/acroforms/fields' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer fePFHv8OtIyRSCAdOnn7USc9kKdYB2rg' \
--data-raw '"JVBERi0xLjY[..]="'
[
{
"value": "",
"fieldName": "TextField1",
"alternateFieldName": "",
"fieldType": "FormTextField",
"bounds": {
"x": 2498,
"y": 13138,
"width": 7996,
"height": 440
}
},
{
"isChecked": false,
"fieldName": "Check Box2",
"alternateFieldName": "",
"fieldType": "FormCheckBox",
"bounds": {
"x": 3519,
"y": 12567,
"width": 7398,
"height": 360
}
}
]
Authorization
This endpoint supports the OAuth authorization method. DS Server checks the access token only when OAuth is enabled in the admin portal (see Enable OAuth). With OAuth disabled, the default of a new installation, the endpoint accepts requests without a token.
DS Server implements OAuth as the authorization method. Two flows are supported:
- Authorization Code
- Client Credentials
To use the Client Credentials flow, switch on Allow “Client Credentials” grant type in the security profile (see OAuth Grant Types).
In both cases, a valid access token returned from the OAuth endpoints must be passed in a Bearer Authorization Header, as a Query Parameter or in a Cookie.
Authorization Header
| Header field | Description |
|---|
| Authorization | A Bearer authorization header (also called token authentication) contains the OAuth access token. The authorization method and a space i.e. "Bearer " is then put before your valid access token. For example: Authorization: Bearer 4796E23054E64BC773CACBCAF24AD179DE9A3 |
Query Parameter
| Query parameter | Description |
|---|
| access_token | The access token is passed directly in the endpoint URL as a query string. For example: ?access_token=4796E23054E64BC773CACBCAF24AD179DE9A3 |
Cookie
| Cookie | Description |
|---|
| access_token | The access token is passed in a cookie named access_token. For example: Cookie: access_token=4796E23054E64BC773CACBCAF24AD179DE9A3 |
Request Payload
| Type | Value |
|---|
| String | The PDF document encoded as a Base64 string. |
Success Response
| Status | Type | Description |
|---|
| 200 | FormField | On success, the HTTP status code in the response header is 200 (OK). The response body contains an array of FormField objects. |
FormField
| Name | Type | Value | Optional |
|---|
| alternateFieldName | String | The alternate field name. | yes |
| fieldName | String | The field name. | yes |
| fieldType | String | The field type, for example "FormTextField" or "FormCheckBox". | yes |
| bounds | Rectangle | The bounds of the field in the document. | yes |
| FormTextField | Inherited object. See description below. | yes |
| FormCheckBox | Inherited object. See description below. | yes |
| FormButton | Inherited object without further properties. | yes |
| FormChoiceField | Inherited object. See description below. | yes |
| FormComboBox | Inherited object. See description below. | yes |
| FormListBox | Inherited object. See description below. | yes |
| FormRadioButton | Inherited object. See description below. | yes |
Rectangle
| Name | Type | Value | Optional |
|---|
| x | Integer | The horizontal position of the rectangle. | no |
| y | Integer | The vertical position of the rectangle. | no |
| width | Integer | The width of the rectangle. | no |
| height | Integer | The height of the rectangle. | no |
FormTextField
| Name | Type | Value | Optional |
|---|
| value | String | The text of the text field. | yes |
FormCheckBox
| Name | Type | Value | Optional |
|---|
| isChecked | Boolean | Specifies whether the check box is checked or not. | yes |
FormChoiceField
| Name | Type | Value | Optional |
|---|
| options | String[] | Gets or sets the option elements of a choice field. | yes |
| canEdit | Boolean | Specifies whether a field can be edited. | yes |
| sort | Boolean | Specifies whether the list can be sorted. | yes |
| multiSelect | Boolean | Specifies whether multiple options can be selected. | yes |
| doNotSpellCheck | Boolean | Specifies whether the text is not spell checked. | yes |
| commitOnSelChange | Boolean | Specifies whether the new value is committed as soon as the selection changes. | yes |
| value | String | Gets or sets the selected value of a choice list. | yes |
FormComboBox
| Name | Type | Value | Optional |
|---|
| options | String[] | Gets or sets the option elements of a choice field. | yes |
| canEdit | Boolean | Specifies whether a field can be edited. | yes |
| sort | Boolean | Specifies whether the list can be sorted. | yes |
| multiSelect | Boolean | Specifies whether multiple options can be selected. | yes |
| doNotSpellCheck | Boolean | Specifies whether the text is not spell checked. | yes |
| commitOnSelChange | Boolean | Specifies whether the new value is committed as soon as the selection changes. | yes |
| value | String | Gets or sets the selected value of a choice list. | yes |
FormListBox
| Name | Type | Value | Optional |
|---|
| options | String[] | Gets or sets the option elements of a choice field. | yes |
| canEdit | Boolean | Specifies whether a field can be edited. | yes |
| sort | Boolean | Specifies whether the list can be sorted. | yes |
| multiSelect | Boolean | Specifies whether multiple options can be selected. | yes |
| doNotSpellCheck | Boolean | Specifies whether the text is not spell checked. | yes |
| commitOnSelChange | Boolean | Specifies whether the new value is committed as soon as the selection changes. | yes |
| value | String | Gets or sets the selected value of a choice list. | yes |
FormRadioButton
| Name | Type | Value | Optional |
|---|
| isChecked | Boolean | Specifies whether the radio button is selected or not. | yes |
Error Response
| Status | Description |
|---|
| 401 | A 401 (Unauthorized) with an empty body is returned, if OAuth is enabled and the request has no valid access token. |
| 400 | A 400 (Bad Request) is returned, if the body can't be read as a JSON string ("The JSON value could not be converted to System.String."). The body is a problem details object (application/problem+json) with the title "One or more validation errors occurred." and the message per field in errors. This check comes before the license check. |
| 415 | A 415 (Unsupported Media Type) is returned, if the Content-Type header of a request with a body is not application/json. |
| 405 | A 405 (Method Not Allowed) with an empty body and the header Allow: POST is returned for any other HTTP method, for example GET. |
| 400 | A 400 (Bad Request) is returned, if DS Server is not licensed or the license is invalid. On a server that is not registered, the body is the plain text DS Server is not registered. (text/plain). DS Server checks the license before the parameter values, but after it has read the body and the typed query parameters. |
| 400 | A 400 (Bad Request) is returned, if no fields are found in the PDF document. |
| 400 | A 400 (Bad Request) is returned, if the uploaded document is not valid. |