All our webservices uses session based authentication by our Authenticate webservice. To improve performance and ease the stress on our servers, we ask everyone that uses our webservices to store the sessionId on your side so you do not authenticate too often, as that is unnecessary.
The SessionId is added to a cookie with the name “ASP.NET_SessionId” and sent to every webservice that you use.
To authenticate you use the Login-method with a Credential object. You must specify ApplicationId, Username and Password (IdentityId does not need to be set). Username is always an email address
<credential> <ApplicationId>guid</ApplicationId> <IdentityId>guid</IdentityId> <Password>string</Password> <Username>string</Username> </credential>
If the login was successful you will get a Login Response containing your SessionId:
<LoginResponse xmlns="http://24sevenOffice.com/webservices"> <LoginResult>xxxxxxxyyyyyyyyyzzzzzzzz</LoginResult> </LoginResponse>
Sessions, identities and community users
There are some important concepts that you need to be familiar with. When you have done a successful request to Login, you will get a SessionId in return. This SessionId is linked to a default Identity. In an integration you need to have some interaction with your user to make sure that the integration uses the correct Identity. You need to make a request to GetIdentities in order to get a list of available Identities for a given session. You then have to present this list to your user. The relevant information for the user is the Name of the Client
<Client> <Id>long</Id> <Name>string</Name> </Client>
Once the user has chosen a client and it is not the current or default client, you need to switch the Identity.
Your community user has a default identity when you log in. If there are several Identities associated with your community user, you invoke the GetIdentities method to get a complete list. Now you may switch to another Identity by using SetIdentity (pass the whole Identity object) or SetIdentityById (pass the Identity Guid). You may also set the Identity directly in your requests to Login by using the IdentityId property.
Please note that the IdentityId can change, so you should always implement checks to see which Identity is currently active. The IdentityId can change if an Identity is removed and then readded to a community user.
In order to add identities you need to log in and add them manually by clicking on your company name in the top right corner, then entering firm and user credentials that have been provided to you either from our support or from your customer.
|Method||Input Type||Input name||Return type||Description|
|Login||Credential||credential||string||Authenticates the user and returns the session ID|
|HasSession||-||-||bool||Returns whether or not the current session is valid|
|GetIdentities||-||-||identity||Returns a list of community Identities|
|SetIdentity||identity||identity||bool||Sets a current identity|
|SetIdentityById||Guid||identity||bool||Sets a current identity by its Guid|
|GetIdentity||-||-||identity||Returns the current identiy|
|AuthenticateByToken||Token||token||Passport||Authenticates with the given token and returns the passport.|