Data Read with Filter using Post and Curl example (with resolveDepth recurence)

Tested by Arkadiusz Binder @2018-04-11
Use this example to filter Data from API by using curl scripting environment:
  1. Prepare XML file with WFS QUERY with filter
    <GetFeature xmlns="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/
            <wfs:PropertyName>ID</wfs:PropertyName>
            <wfs:PropertyName>PARENT_ID</wfs:PropertyName>
            <wfs:PropertyName>TYPE</wfs:PropertyName>
            <wfs:PropertyName>DESC</wfs:PropertyName>
            <wfs:PropertyName resolve="all" resolveDepth="2">default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW</wfs:PropertyName>
            <ogc:Filter>
                    <ogc:Or>
                            <ogc:PropertyIsEqualTo>
                                    <ogc:PropertyName>ID</ogc:PropertyName>
                                    <ogc:Literal>1003</ogc:Literal>
                            </ogc:PropertyIsEqualTo>
                            <ogc:PropertyIsEqualTo>
                                    <ogc:PropertyName>ID</ogc:PropertyName>
                                    <ogc:Literal>608</ogc:Literal>
                            </ogc:PropertyIsEqualTo>
                    </ogc:Or>
            </ogc:Filter>
    </wfs:Query></GetFeature>
  2. Save this file to /tmp/Query.xml
  3. Prepare Base64 username:password by executing:
    echo user:password |base64
    We get the result (we copy it)
    dXNlcjpwYXNzd29yZAo=
  4. Get the cookie file for authorizing future transacions:
    curl -c /tmp/cookie -H 'Authorization: Basic dXNlcjpwYXNzd29yZAo=' "https://yourdomain.procesy5.com/SE/wfs-data.php"
  5. Exec the following command:
    /opt/local/bin/curl  -b /tmp/cookie -XPOST -H "Content-type: text/xml" -d @/tmp/Query.xml \
    "https://yourdomain.procesy5.com/SE/wfs-data.php/default_db/?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW&SRSNAME=EPSG:3003&maxFeatures=5"
    1. You get the following response:
      <?xml version="1.0" encoding="UTF-8"?>
      <wfs:FeatureCollection xmlns:wfs="http://www.opengis.net/wfs" xmlns="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:default_db__x3A__CRM_LISTA_ZASOBOW="https://biuro.biall-net.pl/wfs/default_db/CRM_LISTA_ZASOBOW" xmlns:p5="https://biuro.biall-net.pl/wfs" xmlns:default_db__x3A__ADMIN_USERS="https://biuro.biall-net.pl/wfs/default_db/ADMIN_USERS" xmlns:default_db__x3A__CRM_WSKAZNIK="https://biuro.biall-net.pl/wfs/default_db/CRM_WSKAZNIK" xmlns:default_db__x3A__CRM_IMAGE="https://biuro.biall-net.pl/wfs/default_db/CRM_IMAGE" xmlns:default_db__x3A__IN7_MK_BAZA_DYSTRYBUCJI="https://biuro.biall-net.pl/wfs/default_db/IN7_MK_BAZA_DYSTRYBUCJI" xmlns:default_db__x3A__USERS2_MARKETING="https://biuro.biall-net.pl/wfs/default_db/USERS2_MARKETING" xmlns:default_db__x3A__DEVICES="https://biuro.biall-net.pl/wfs/default_db/DEVICES" xmlns:default_db__x3A__CRM_PROCES="https://biuro.biall-net.pl/wfs/default_db/CRM_PROCES" xmlns:default_db__x3A__CRM_PRZYPADEK="https://biuro.biall-net.pl/wfs/default_db/CRM_PRZYPADEK" xsi:schemaLocation="https://biuro.biall-net.pl/wfs/default_db/CRM_LISTA_ZASOBOW https://biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW&amp;REQUEST=DescribeFeatureType" numberMatched="unknown" numberReturned="2" next="https://biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=GetFeature&amp;TYPENAME=default_db__x3A__CRM_LISTA_ZASOBOW%3ACRM_LISTA_ZASOBOW&amp;SRSNAME=EPSG%3A3003&amp;maxFeatures=5&amp;startIndex=5">
       <gml:featureMember>
        <default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW fid="CRM_LISTA_ZASOBOW.1003" p5:primaryKey="1003">
         <default_db__x3A__CRM_LISTA_ZASOBOW:ID>1003</default_db__x3A__CRM_LISTA_ZASOBOW:ID>
         <default_db__x3A__CRM_LISTA_ZASOBOW:DESC>do_dokumentu</default_db__x3A__CRM_LISTA_ZASOBOW:DESC>
         <default_db__x3A__CRM_LISTA_ZASOBOW:TYPE>KOMORKA</default_db__x3A__CRM_LISTA_ZASOBOW:TYPE>
         <default_db__x3A__CRM_LISTA_ZASOBOW:PARENT_ID>990</default_db__x3A__CRM_LISTA_ZASOBOW:PARENT_ID>
        </default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW>
       </gml:featureMember>
       <gml:featureMember>
        <default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW fid="CRM_LISTA_ZASOBOW.608" p5:primaryKey="608">
         <default_db__x3A__CRM_LISTA_ZASOBOW:ID>608</default_db__x3A__CRM_LISTA_ZASOBOW:ID>
         <default_db__x3A__CRM_LISTA_ZASOBOW:DESC>555-01</default_db__x3A__CRM_LISTA_ZASOBOW:DESC>
         <default_db__x3A__CRM_LISTA_ZASOBOW:TYPE>KONTO-KSIEGOWE-OLD</default_db__x3A__CRM_LISTA_ZASOBOW:TYPE>
         <default_db__x3A__CRM_LISTA_ZASOBOW:PARENT_ID>236</default_db__x3A__CRM_LISTA_ZASOBOW:PARENT_ID>
        </default_db__x3A__CRM_LISTA_ZASOBOW:CRM_LISTA_ZASOBOW>
       </gml:featureMember>
      </wfs:FeatureCollection>
Note: