Library Developer Home Overview Address Documents PDF to Text/JSON Decode & Analyse PDF Email Subject to UTF8

Base Functions

Base Functions are a collection of online APIs that can be called to provide specific functionality. They are not directly using your Fieldpine data and are typically publicly visible.

The primary purpose of these functions is code within Fieldpine to call an API to perform processing that is difficult to deploy to every end site and a centralised server is a better solution


Street Addresses

Split an address

Takes an address as a single string, or array of lines and extracts the various key facts

Endpoint/wc1/basefuncs/AddressDecodeSplit
Inputs "address" A string with each line seperated by newline characters,
Or, an array of text lines
fromcountry Default country to process from. Used to select which country database should be used first. The address can override this if it contains an explicit country
If not provided the API may use any means to try and determine this automatically.
Outputs"label"Array of text lines that form the final address label
  • Not all countries are loaded, more can be added if needed
  • Can be called using GET or POST
POST /wc1/basefuncs/AddressDecodeSplit
body:
{
    "address": "12 Queen st\nAuckland",
    "fromcountry": "New Zealad"
}

response:
"data": {
    "label": [ "12 Queen St", "Auckland" ]
}

Try it

Address:
From Country




                

Email

Email Subject to UTF8

Takes an email subject line encoding using RFC standards and returns a single UTF8 string

Endpoint/wc1/basefuncs/EmailSubjectToUTF8
Inputs"subject"Raw Subject line from EML
Outputs"subject_utf8"Resulting subject in UTF8 format
  • Input subject cannot be longer than 1000 bytes
  • Commonly used character sets are supported, rarely used character sets may not be decoded
  • Can be called using GET or POST
Example
GET /wc1/basefuncs/EmailSubjectToUTF8?subject==?iso-8859-4?Q?Invoice_from_K=F2kako?=

response:
{
    "subject_utf8": "Invoice from Kōkako" 
}
POST /wc1/basefuncs/EmailSubjectToUTF8
body:
{
    "subject": "=?ISO-2022-JP?B?SSBhbSBhIFByb2R1Y3QgRGVzaWduZXIgIGFuZCBJJ20gaW50ZXJlc3RlZCBpbiBzZWVpbmcgeW91ciBjdXJyZW50IG9wZW5pbmdzLg==?="
}

response:
{
    "subject_utf8": "I am a Product Designer  and I'm interested in seeing your current openings."
}

Try it

Email Subject Line:


            

Documents

PDF to JSON Text

Converts a PDF into JSON containing the raw text

Endpoint/wc1/emailhttp/PdfToText
InputsbodyRaw PDF file data
Outputs"pages"Array of pages, where each array element is an array of strings for that page
Example
POST /wc1/emailhttp/PdfToText

... body PDF ... response: { "pages": [ [ " Tax Invoice", " GST 12-345-678", "Bill to", "EXAMPLE CORP Date 16/10/2023", ... ],[ "Page 2", ... ] ] }

Try it

Select a PDF file