This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Users in FreeAgent



Overview

The following operations allow you to work with users. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with users, see Sample configuration

OperationDescription
getUserByIdRetrieves a single user by ID.
listUsersRetrieves all users.

Operation details

This section provides further details on the operations related to users.

Retrieving a single user by ID

The getUserById operation retrieves a single user by ID.

getUserById
<freeagent.getUserById>
	<id>{$ctx:id}</id>
</freeagent.getUserById>
Properties
  • id: The ID of the user.
Sample request

Following is a sample REST/JSON request that can be handled by the getUserById operation.

Sample Request for getUserById
{
	"accessToken":"1S1Sd_eb-pE0hjMJnWrYmj4vfi496Gf0YyRhzzgRE",
	"apiUrl":"https://api.sandbox.freeagent.com",
	"id":"827"
}
Related FreeAgent documentation

https://dev.freeagent.com/docs/users#get-a-single-user

Retrieving all users

The listUsers operation retrieves all users.

listUsers
 </freeagent.listUsers>
Sample request

Following is a sample REST/JSON request that can be handled by the listUsers operation.

listUsers
{
	"accessToken":"1S1Sd_eb-pE0hjMJnWrYmj4vfi496Gf0YyRhzzgRE",
	"apiUrl":"https://api.sandbox.freeagent.com",
}
Related FreeAgent documentation

https://dev.freeagent.com/docs/users#list-all-users

Sample configuration

Following is a sample proxy service that illustrates how to connect to FreeAgent with the init operation and use the getUserById operation. The sample request for this proxy can be found in the getUserById sample request. You can use this sample as a template for using other operations in this category.

Sample Proxy
<?xml version="1.0" encoding="UTF-8"?>
	<proxy xmlns="http://ws.apache.org/ns/synapse" name="freeagent_getUserById" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
	 <target>
	 <inSequence>
      <property name="accessToken" expression="json-eval($.accessToken)"/>
      <property name="apiUrl" expression="json-eval($.apiUrl)"/>
      <property name="id" expression="json-eval($.id)"/>
      <freeagent.init>
         <accessToken>{$ctx:accessToken}</accessToken>
         <apiUrl>{$ctx:apiUrl}</apiUrl>
      </freeagent.init>
      <freeagent.getUserById>
         <id>{$ctx:id}</id>
      </freeagent.getUserById>
	   <respond/>
	 </inSequence>
	  <outSequence>
	   <send/>
	  </outSequence>
	 </target>
   <description/>
  </proxy>