API Details – Key Points

Retrieve the SearchString from the QueryParameters:

   

#SearchString := #Context.Request.QueryParameters<'SearchString'>.Value.UpperCase

 

Begin writing an array of potential matches:

   

#Writer.BeginArray

 

Select from xContacts table and write any matches:

     Select Fields(#ContactFields) From_File(xContacts)
        If ((#SearchString = '') *OrIf #xContactFirstName.UpperCase.Contains( #SearchString ) *OrIf #xContactLastName.UpperCase.Contains( #SearchString ))
            #Writer.BeginObject
               #Writer.WriteInt32( #xContactIdentification, 'ContactId' )
               #Writer.WriteString( #xContactFirstName, 'FirstName' )
               #Writer.WriteString( #xContactLastName, 'LastName' )
            #Writer.EndObject
        Endif
     Endselect

 

End writing the array of potential matches:

 

  #Writer.EndArray"