Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How to send http post and grab response data?

Featured Replies

I'm working with XML web services like eBay/PayPal/FedEx, etc. If I have an XML string stored in a variable within my FM script, how can I setup an HTTP post to send this request (including HTTP Header information that I need to add) and then store the response in a separate FM variable in order to parse out the data?

In our current FM solution there are a few scripts that others have created in which they do exactly what I'm talking about with FedEx rates. However, they're using the External function like this:

Set Variable $$RateResponse_FedEx

Value: External( "JAVB-Command"; "NETT-NewForm")

Set Variable $$RateResponse_FedEx

Value: External( "JAVB-Command"; "NETT-SetFormData|"&$$RateRequest_FedEx)

Set Variable $$RateResponse_FedEx

Value: External( "JAVB-Command"; "NETT-SubmitForm|https://gateway.fedex.com:443/GatewayDC"&"|"&"30")

Set Variable $$RateREsponse_FedEx

Value: External("JAVB-Command"; "NETT-GetResponseData")

I looked up a reference to the External function and I found that it's used for versions of FM previous to 7 to call plug-ins..?? Is there a better way to do this now? I did play with copying what they did here but I'm getting unexpected results and could use some help.

Any information on this would be greatly appreciated. Thanks!

  • Author

Ok, I figured out that it's using the NetTools plug-in. I installed that I went through the documentation and now I'm able to send the requests and get the response successfully.

Any tips for parsing data out of an XML file and storing it in FM variables within the script so that I can then populate fields in FM with those values?

  • 3 weeks later...

drew -

check out this custom function we wrote for parsing xml.

http://www.briandunning.com/cf/1

You may also be interested in our FedEx certified solution which allow for simple fedex shipping, rates and tracking integration with full support for thermal printers and digital scales. (we have similar tools for UPS and DHL)

http://www.nrgsoft.com/products/

  • Newbies

Hi,

You might want to take a look at my article "HTTP POST from FileMaker" at http://fmdiff.com/fm/curlpost.html

I think it covers all you want to know!

Winfried

  • Author

nrg software -

Actually, I'm already putting your function to good use in some applications, thank you!

It's difficult to use with larger XML datasets, though, like API calls from eBay and PayPal. Unless I'm missing something, I haven't been able to find an easy way to parse through an entire node of data, then move on to the next node. For instance, in datasets like

<1>1>

<2>2>

<1>1>

<2>2>

I need to be able to pull all elements from the first product node, do what I need with them, and then pull all from the 2nd product node, do the same thing, etc.

With your function I have to specify which occurance of the node I'd like to grab the data for. I usually don't know how many nodes are going to come back though, much less with occurance I need.

Am I mis-using your tool?

drew -

use a loop to go thru larger datasets...

set variable $max = patterncount ( $xml ; "Product" )

set variable $ctr = 0

loop

set variable $ctr = $ctr + 1

set variable $product = ExtractData ( $xml ; "Product" ; $ctr )

... begin process each product...

new record/request

set field 1 = ExtractData ($product ; "1" ; 1 )

set field 2 = ExtractData ($product ; "2" ; 1 )

... end process each product ...

exit loop if $max = $ctr

end loop

Using Acme, you may hit a 64k limit on data if pulling back large sets of XML data.

  • Author

Hey, cool. I can work with that. Thanks!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.