4 Protocol Examples

The following example demonstrates a client request to synchronize notes data with the server, and the server response. In this example, the client uses the Sync command request ([MS-ASCMD] section 2.2.1.21) to create one note, update one note that does not exist on the server, and delete one note.

Request:

 <?xml version="1.0" encoding="utf-8"?>
 <Sync 
 xmlns:airsyncbase="AirSyncBase" 
 xmlns:notes="Notes" xmlns="AirSync">
   <Collections>
     <Collection>
       <SyncKey>398434774</SyncKey>
       <CollectionId>8</CollectionId>
       <DeletesAsMoves>1</DeletesAsMoves>
       <GetChanges>1</GetChanges>
       <WindowSize>512</WindowSize>
       <Options>
         <airsyncbase:BodyPreference>
           <airsyncbase:Type>2</airsyncbase:Type>
           <airsyncbase:TruncationSize>5120</airsyncbase:TruncationSize>
           <airsyncbase:AllOrNone>1</airsyncbase:AllOrNone>
         </airsyncbase:BodyPreference>
       </Options>
       <Commands>
         <Add>
           <ClientId>c212ac10-0465-4983-a898-076e152552ef</ClientId>
           <ApplicationData>
             <airsyncbase:Body>
               <airsyncbase:Type>2</airsyncbase:Type>
               <airsyncbase:Data>A new note I just created.</airsyncbase:Data>
             </airsyncbase:Body>
             <notes:Categories>
               <notes:Category>Business</notes:Category>
             </notes:Categories>
             <notes:Subject>New note</notes:Subject>
             <notes:MessageClass>IPM.StickyNote</notes:MessageClass>
           </ApplicationData>
         </Add>
         <Delete>
           <ServerId>8:1</ServerId>
         </Delete>
         <Change>
           <ServerId>bb18e2a7-3e65-41a1-b0b2-9815539f98ad</ServerId>
           <ApplicationData>
             <airsyncbase:Body>
               <airsyncbase:Type>2</airsyncbase:Type>
               <airsyncbase:Data>&lt;strong&gt;This is my second note.&lt;/strong&gt;</airsyncbase:Data>
             </airsyncbase:Body>
             <notes:Categories>
               <notes:Category>Business</notes:Category>
             </notes:Categories>
             <notes:Subject>Second Note</notes:Subject>
             <notes:MessageClass>IPM.StickyNote</notes:MessageClass>
           </ApplicationData>
         </Change>
       </Commands>
     </Collection>
   </Collections>
 </Sync>

Response:

 <?xml version="1.0" encoding="utf-8"?>
 <Sync xmlns="AirSync">
   <Collections>
     <Collection>
       <SyncKey>1960353427</SyncKey>
       <CollectionId>8</CollectionId>
       <Status>1</Status>
       <Responses>
         <Add>
           <ClientId>c212ac10-0465-4983-a898-076e152552ef</ClientId>
           <ServerId>8:3</ServerId>
           <Status>1</Status>
         </Add>
         <Change>
           <ServerId>bb18e2a7-3e65-41a1-b0b2-9815539f98ad</ServerId>
           <Status>8</Status>
         </Change>
       </Responses>
     </Collection>
   </Collections>
 </Sync>
Show: