API entity search

From FreeDESK
(Difference between revisions)
Jump to: navigation, search
(Created page with "{{Infobox API | name = Entity Search | mode = entity_search | description = Search an Entity | parameters = entity, [fields], start, limit | returned = XML login error or sess...")
 
 
Line 20: Line 20:
 
Would search the customer entity for records with the firstname of david (starting at the beginning and returning a max of 30 results)
 
Would search the customer entity for records with the firstname of david (starting at the beginning and returning a max of 30 results)
 
= Returned Data =
 
= Returned Data =
XML containing search results on success or a
+
XML containing search results on success or a [[API XML Error]] on failure.
 +
 
 +
Example returned output on success:
 +
<source lang="xml">
 +
<search-results>
 +
<meta>
 +
<field-data>
 +
  <id>customerid</id>
 +
  <name>Customer ID</td>
 +
</field-data>
 +
<field-data>
 +
  <id>firstname</id>
 +
  <name>First Name</name>
 +
</field-data>
 +
<field-data>
 +
  <id>lastname</id>
 +
  <name>Last Name</name>
 +
</field-data>
 +
<keyfield>customerid</keyfield>
 +
</meta>
 +
<entity>
 +
<field id="customerid">1</field>
 +
<field id="firstname">David</field>
 +
<field id="lastname">Cutting</field>
 +
</entity>
 +
</search-results>
 +
</source>

Latest revision as of 19:02, 21 August 2012

Entity Search
Call/Mode: entity_search
Description: Search an Entity
Parameters: entity, [fields], start, limit
Returned Data: XML login error or session data

This article details a FreeDESK API call.

[edit] Description

The entity_search call will search a registered entity (with valid permissions) and return matches

[edit] Using the Call

Pass in the following parameters using GET or POST

  • entity : Entity
  • start : Start (0 for beginning)
  • limit : Limit number of results (default 30)
  • [fields] : In the form of:
fieldname=value

For example

api.php?mode=entity_search&entity=customer&firstname=david

Would search the customer entity for records with the firstname of david (starting at the beginning and returning a max of 30 results)

[edit] Returned Data

XML containing search results on success or a API XML Error on failure.

Example returned output on success:

<search-results>
 <meta>
 <field-data>
  <id>customerid</id>
  <name>Customer ID</td>
 </field-data>
 <field-data>
  <id>firstname</id>
  <name>First Name</name>
 </field-data>
 <field-data>
  <id>lastname</id>
  <name>Last Name</name>
 </field-data>
 <keyfield>customerid</keyfield>
</meta>
<entity>
 <field id="customerid">1</field>
 <field id="firstname">David</field>
 <field id="lastname">Cutting</field>
</entity>
</search-results>
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox