Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

RestDataSource *.ds.xml example needed (SmartClient, JSON, dynamic URL for POST)

$
0
0
Please, could you provide an example *.ds.xml for RestDataSource where UPDATE operation is made with PUT method to dynamic URL which depends on data values.

I could figure out the operationBinding/script in documentation, but it seems to be ignored when I put it like this (I tried syntax incorrect script there -- also seems to be ignored):

Code:


<RestDataSource ID="dsUsers" dataFormat="json" dataURL="/myapp/rest/users">
    <fields>
        <field name="url" canEdit="false" primaryKey="false"/>
        <field name="login" canEdit="false" primaryKey="true"/>
        <field name="fistName" canEdit="true" primaryKey="false"/>
        <field name="lastName" canEdit="true" primaryKey="false"/>
    </fields>
    <recordXPath>/</recordXPath>
        <operationBindings>
          <operationBinding operationType="fetch" dataProtocol="getParams" />
          <operationBinding operationType="add" dataProtocol="postParams" />
          <operationBinding operationType="remove" dataProtocol="postParams" >
                <requestProperties>
                  <requestProperty httpMethod="DELETE" />
                </requestProperties>
          </operationBinding>
          <operationBinding operationType="update" dataProtocol="postParams" dataURL="/myapp/rest/users">
                <requestProperties>
                  <requestProperty httpMethod="PUT" />
                </requestProperties>
                <script language="javascript">
                  this.dataURL=this.oldValues.url;
                </script>
          </operationBinding>
        </operationBindings>
</RestDataSource>

My user.url contains exactly the URL to be PUT to ("/myapp/rest/users/login").


Please, could you provide any example of *.ds.xml definition with dynamic URL for POST.

Thanks in advance.

Viewing all articles
Browse latest Browse all 4756

Trending Articles