home > support > API > Marketplace API > Travel agent Search

Search travel agents

PurposeGet a list of travel agents. Use if developing a solution to allow creation of bookings assigned to specific travel agents.
NotesAllows searching by several criteria, returns basic information about the agent plus a booking_key that can be used when creating bookings.
 
For use by tour operators only, not available for those accessing the API with Marketplace Agent credentials.
REST info Call/c/agents/search
FormatsXML
Example/p/agents/search.xml?q=Example
VerbGET
Code

PHP examples use the PHP Client Library with SimpleXML

Description

object search_agents ( string $params, int $channel )

Parameters

$params
	Search querystring, see possible values in the table below
$channel
	Your channel

Example

// Channel ID
$channel = 3930;

// Optionally define search parameters
// Here we are just returning agents whose name/code contains the text "Example"
$params = "q=Example";

// Query the TourCMS API
$result = $tourcms->search_agents($params, $channel);

// Loop through each agent
foreach($results->agent as $agent) {
  // Print out the name and code
  print $agent->agent_name." ( ".$agent->agent_code." ) ";
  print "<br />";
}
Example Agent (EXAMP1)
Another Example (EXAMP2)

C# examples use the .Net Client Library

VB examples use the .Net Client Library

Querystring parameters

Querystring parameters
ParameterNotes
orderDefault order is by name, set to toprecent to order by number of recent bookings
agent_idIf you know the agent ID use this, returns a single record
agent_groupLoad agents from a specific group. Exact match only
qSearch agent name/code, returns partial matches
filterSet to staff_ui to limit results to those agents that have had bookings assigned to them by staff - useful if an account contains many agents with only a small subset that will be assigned bookings by staff
per_pageNumber of results to return per page. Max is 500.
pageInteger for which page number to return. Default is page 1

Response fields

Response fields
XML NodeNotes
request Confirmation of the request that you sent
error Any error message returned, if there is no error this will just contain the text OK
total_agent_count Total number of agents returned by the search (i.e. not just the number on this page)
agent

There will be one agent node for each result on this page.

Each agent node contains the following child nodes.

XML NodeNotes
agent_idInternal system ID number for the agent
channel_idChannel ID
account_idAccount ID
agent_codeCode for the agent, freetext (e.g. "TOURCMS16980")
agent_nameName for the agent, freetext (e.g. "Test Agent"
agent_group
total_bookingsTotal number of bookings associated with the agent
recent_bookingsNumber of recent bookings associated with the agent
last_bookedDate the last booking made by the agent was created. YYYY-MM-DD.
booking_keyPass to Start new booking to create a booking assigned to this agent

More information