getAccountInfo with session method
This request to the M2Web API is going to:
- Retrieve basic account information (reference, name, company).
- Retrieve the set of pools visible by user : pairs name/id
- Retrieve the name of each custom attribute.
First we'll need to open a session. This will prevent us from putting our username, password and dev ID in each request (if we were to execute several requests, which is not the case here).
https://m2web.talk2m.com/t2mapi/login?t2maccount=MyAccount&t2musername=MyUsers&t2mpassword=MyPassword&t2mdeveloperid=MyDeveloperID"
M2Web will recognize me and send me a success message:
{ "success": true, "t2msession": "123abc456" }
Now that I've been logged in, I will only need to reference this session ID in my URL.
Let's now ask for what we were looking for: the account information.
https://m2web.talk2m.com/t2mapi/getaccountinfo?t2msession=123abc456
M2Web will answer with:
{ "success": true, "accountReference": "8435", "accountName": "MyAccount", "company": "XXYYZZ, Inc.", "customAttributes": [ "attribute1", "", "third attribute" ], "pools": [ { "id": 8735, "name": "site 1" }, { "id": 9541, "name": "site 2" }, { "id": 723, "name": "devices" } ], "accountType": "Pro" }