Building Web Services with FileMaker Pro
by Bill Humphries
|
Pages: 1, 2, 3, 4
Viewing XML
FileMaker supports two kinds of XML for viewing results. The dso_xml is suited to fetching records for display using record-oriented XML APIs such as RAX. The fmp_xml returns metadata describing the database's layout as well as database records.
To view the record-oriented XML, use the following URL (split here for clarity, enter all as one line):
http://localhost:471/FMPro?-db=phonelist.fp5& -format=-dso_xml&-find
Reviewing the parameters of the request:
- -db: The database.
- -format: The syntax in which to display results
The '-' character before parameter names and values is significant, not a typo.
FileMaker treats each of the request types as a separate keyword instead of defining a request parameter with the types of request as possible values.
Requesting this URL returns:
<?xml version="1.0"?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>phonelist.fp5</DATABASE>
<LAYOUT>
</LAYOUT>
<ROW MODID="2" RECORDID="1">
<Name>Jody Tester</Name>
<Phone>512 111-2222</Phone>
<Location>Austin</Location>
</ROW>
<ROW MODID="0" RECORDID="2">
<Name>Mary Sysadmin</Name>
<Phone>512 222-3333</Phone>
<Location>Austin</Location>
</ROW>
<ROW MODID="0" RECORDID="3">
<Name>Joe Developer</Name>
<Phone>408 444-5555</Phone>
<Location>Cupertino</Location>
</ROW>
<ROW MODID="0" RECORDID="4">
<Name>Bob Analyst</Name>
<Phone>916 666-7777</Phone>
<Location>Sacramento</Location>
</ROW>
<ROW MODID="0" RECORDID="6">
<Name>Karen Project</Name>
<Phone>508 666-7777</Phone>
<Location>Cupertino</Location>
</ROW>
</FMPDSORESULT>
|
|
| Post your comments |
Note that each FileMaker XML result set contains an ERRORCODE element. If all is well, then the text child of that element is '0'.
To restrict the results by Location, for example, add the field name and the value, to screen for, to the request:
http://localhost:471/FMPro?-db=phonelist.fp5& -format=-dso_xml&Location=Austin-find
FileMaker expects the request type as the last parameter in GET requests. If it is not at the end of the URL, FileMaker Pro will return an HTML/JavaScript error.
This URL returns:
<?xml version="1.0"?>
<FMPDSORESULT xmlns="http://www.filemaker.com/fmpdsoresult">
<ERRORCODE>0</ERRORCODE>
<DATABASE>phonelist.fp5</DATABASE>
<LAYOUT>
</LAYOUT>
<ROW MODID="2" RECORDID="1">
<Name>Jody Tester</Name>
<Phone>512 111-2222</Phone>
<Location>Austin</Location>
</ROW>
<ROW MODID="0" RECORDID="2">
<Name>Mary Sysadmin</Name>
<Phone>512 222-3333</Phone>
<Location>Austin</Location>
</ROW>
</FMPDSORESULT>
You can find more documentation on the XML-HTTP interface to FileMaker Pro at FileMaker's web site
Now that we're receiving XML from FileMaker, we can format it for display in a browser.