Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Partner Program >

Get Organisations List

Started by Johny Motorhead -   in Partner Program

Hi Everyone!

Well, we develop an partner API application. We've got 2 questions about XERO:

1. When we want to change session's organisation, ts it necessary to disconnect from current one and to get new Authorization request/access tokens?

Let me describe in details - I've created 3 organisations for my profile. But when I go to https://api.xero.com/Preview/Organisation and call the organisation it returns me only one (to that I currently connected). If I want to choose another one, I need to disconnect from current, and get new request/access tokens for choose organisation.

2. According to first question, I have only 1 organisation in my Xero Current session repository (but as I mentioned above I have 3 organisations). Is there any chanse to have all 3 organisation in one session and deal with them?

Any help will greatly appriciated.

Hi John

Each session is a unique pairing of your application and an organisation in Xero.
So each access token / session can be used with one Xero organisation only.

In order to work with three Xero organisations, you would need to make separate API calls using the separate sessions and tokens for each.



Ronan Quirke (Community Manager)  

Hi Ronan!

Thanks for such quick response! Just to clarify things, can I ask ur advise - in this case what technique to use better?
1. Can we store request/access tokens (as a strings) to switch between organisations in current session?
2. Or can we store some kind "pool of sessions" and switch somehow beetween them?
3. Or anyway we need to disconnect from current organisation and get new request/access tokens?

Thanks in advance,

Johny Motorhead  


I've made some tests, and I store pool of repositories in static class (I use C#).

We also have an idea to soter in Data Base request and access tokens. Let's say user have closed the browser. Is there any way to use request/access tokens string to connect to organisation instead to authorize to it once again?

Let me explain - user have closed the browser and lost session. Then he opens our web application, login to XERO and use stored request/access tokens strings to authorize. Can we do this way? I mean - take these strings, pasrse it, create access/request tokens and write it to session?

May be my explanation are confused, sorry for that.


Johny Motorhead