Using NetVerify web service with FileMaker
Today we worked with a client using our plugin to implement the netverify API calls using our CURL functions.
As you see this service takes form data with a JSON text and an image file. The picture is a photo of the driver license and this API returns the actual data of the driver and validates the ID. So if the driver license is invalid or expired, you get back an error. People can use this in the field, take picture with iOS device and than perform a script on server to call our plugin to query the server. The result can than be used in the FileMaker solution.
#Setup transfer
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "https://netverify.com/api/netverify/v2/fastfill")]
Set Variable [$result; Value:MBS("CURL.SetOptionVerbose"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; "05f1e486-3452-4265-3434-77d53bdc7fb9")]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; "Krpo1QNoSokiChtghfkloFR9YdKFidLJ7")]
Set Variable [$result; Value:MBS("CURL.SetOptionHTTPHeader"; $curl; "Accept: application/json"; "Expect:")]
Set Variable [$metadata; Value:"{\"type\": \"DRIVING_LICENSE\",\"country\": \"USA\"}"]
Set Variable [$r; Value:MBS("CURL.FormAddKeyValue";$curl; "metadata"; $metadata)]
Set Variable [$r; Value:MBS("CURL.FormAddKeyContainerContentType";$curl; "backsideImage"; "test.jpg"; Test::Image; "image/jpeg")]
Set Variable [$r; Value:MBS("CURL.FormFinish";$curl)]
#Run transfer
Set Field [Donor Docs::ResultCodePost; MBS("CURL.Perform"; $curl)]
#Check result
Set Field [Donor Docs::DebugTextPost; MBS("String.ReplaceNewline"; MBS("CURL.GetDebugAsText"; $curl);1)]
Set Variable [$result; Value:MBS("String.ReplaceNewline"; MBS("CURL.GetResultAsText"; $curl);1)]
Set Field [Donor Docs::ResultTextPost; $result]
Maybe this script helps you if you need to talk to a similar service.