Skip to content

Creating queries

Lucas Alexander edited this page Aug 5, 2013 · 1 revision

###Creating Queries###

The FetchXML queries that will be used for the actual web service interfaces are stored in individual XML files in a specific directory on the web server, and when a web service consumer calls the service, the "query" parameter maps queries to requests. In addition to predefined FetchXML, queries can contain paramter substitution placeholders in the format of {$PARAMETER_NAME} that will be replaced with values supplied by the web service consumer. Here's an example query that is stored in a file called contacts.xml:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="contact">
    <attribute name="fullname" />
    <attribute name="contactid" />
    <attribute name="ownerid" />
    <attribute name="address1_stateorprovince" />
    <attribute name="gendercode" />
    <attribute name="createdon" />
    <order attribute="fullname" descending="false" />
    <filter type="and">
      <condition attribute="lastname" operator="like" value="{$lastnameletter}%" />
    </filter>
  </entity>
</fetch> 

Here are the SOAP request and response that correspond to this query:

  1. soap-request.txt
  2. soap-response.txt

Clone this wiki locally