January 23, 20188 yr Hello, I am trying to connect to our current database with our shipping company so I can update the status of the delivered orders. To do that, I am currently using insert from URL and then parse the code to extract the info I need. However, I believe there should be a cleaner and safer way to do it using webservice. So I downloaded the documentation and looks very straightforward to set and I have been able to set up the POST and send it getting the data as XML using POSTMAN (as very well explained here: http://www.filemakerprogurus.com/filemaker-api-integration-salvatore-coleangelo/ ) and also in the great post by luminfire https://luminfire.com/2017/06/12/curling-filemaker-16/. However, when I try the same parameters on my script in filemaker, I get all the time an error saying that something like "Entry XML Schema/template it is not loaded correctly". Following the documentation of the API I see that on Postman I need to insert on the Body RAW some kind of code that looks like this: <?xml version='1.0' encoding='UTF-8'?> <SeguimientoEnviosRequest xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='SeguimientoEnviosRequest.xsd'> <Solicitante>x</Solicitante><Dato>xxxxxxxxxxxxxxxxx</Dato> </SeguimientoEnviosRequest> but I don't know which settings I have to do on my script to make the call work. Any suggestions as to where to put this info so the can be passed with the CURL? I am a bit desperate now because I see the amazing possibilities that the interaction with the web service may bring but I can find a way to make it work... Thanks a lot for your always invaluable support!!
January 23, 20188 yr Author 2 hours ago, docasar said: Hello, I am trying to connect to our current database with our shipping company so I can update the status of the delivered orders. To do that, I am currently using insert from URL and then parse the code to extract the info I need. However, I believe there should be a cleaner and safer way to do it using webservice. So I downloaded the documentation and looks very straightforward to set and I have been able to set up the POST and send it getting the data as XML using POSTMAN (as very well explained here: http://www.filemakerprogurus.com/filemaker-api-integration-salvatore-coleangelo/ ) and also in the great post by luminfire https://luminfire.com/2017/06/12/curling-filemaker-16/. However, when I try the same parameters on my script in filemaker, I get all the time an error saying that something like "Entry XML Schema/template it is not loaded correctly". Following the documentation of the API I see that on Postman I need to insert on the Body RAW some kind of code that looks like this: <?xml version='1.0' encoding='UTF-8'?> <SeguimientoEnviosRequest xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='SeguimientoEnviosRequest.xsd'> <Solicitante>x</Solicitante><Dato>xxxxxxxxxxxxxxxxx</Dato> </SeguimientoEnviosRequest> but I don't know which settings I have to do on my script to make the call work. Any suggestions as to where to put this info so the can be passed with the CURL? I am a bit desperate now because I see the amazing possibilities that the interaction with the web service may bring but I can find a way to make it work... Thanks a lot for your always invaluable support!! This is how postmant shows the cURL code: curl -X POST \ https://www.correosexpress.com/wpsc/apiRestSeguimientoEnvios/rest/seguimientoEnvios \ -H 'Authorization: Basic Zmxhc2thOmlUZnl4' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/xml' \ -H 'Postman-Token: ff84b952-74c8-f06b-976d-f860d9d66de7' \ -d '<?xml version='\''1.0'\'' encoding='\''UTF-8'\''?><SeguimientoEnviosRequest xmlns:xsi='\''http://www.w3.org/2001/XMLSchema-instance'\'' xsi:noNamespaceSchemaLocation='\''SeguimientoEnviosRequest.xsd'\''><Solicitante>x</Solicitante><Dato>xxxxxxxxxxxxxxxxx</Dato> </SeguimientoEnviosRequest>' Any ideas how to translate that into FIlemaker curl options so it would work? Aparently that last part of the code "-d" is what is failing to send with POST on Filemaker Thanks a lot...
January 26, 20188 yr Author Ok... After LOTS of testing I figure out how it should be done, so I am just updating my own post to share the info in case anyother "amateur" developer as myself would encouter similar challenge I just figure out how to pass that "-d" data with the XML code, what I did was: 1) Create variable ( $rawdata ; <?xml version="1.0" encoding="UTF-8"?> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SeguimientoEnviosRequest.xsd"><Solicitante>1</Solicitante><Dato>xxxxxxxxxxxxxxxx</Dato> </SeguimientoEnviosRequest>) 2) I was using the lumifire example for CURL testing ( https://luminfire.com/2017/06/12/curling-filemaker-16/) and on the $options variable that is set on their script I just added an extra curl option as: " -d " & "\"" & Substitute ( $rawdata; "\""; "\\\"" ) & "\"" 3) FEEL THE JOY!!!!! when I get the XML info back Thanks a lot, Best regards!
Create an account or sign in to comment