REST API: Difference between revisions

From Tygron Preview Support Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:
* [http://en.wikipedia.org/wiki/JSON JSON] format.
* [http://en.wikipedia.org/wiki/JSON JSON] format.
* [http://en.wikipedia.org/wiki/Transport_Layer_Security SSL encrypted] with same credentials for normal Engine login.
* [http://en.wikipedia.org/wiki/Transport_Layer_Security SSL encrypted] with same credentials for normal Engine login.
===Session infrastructure===
The Tygron Engine acts as a central server. On it, information regarding domains, users and projects is stored. To interact with a project (whether it's creating, editing or playing) the project must be started in the appropriate fashion on the server.
To start a session on the server, you must authenticate with appropriate credentials. You can then instruct the server to start your project in a variety of modes. After the session has started, you can request information regarding the session, including a server token with which you can interact with the session, and a client token which will serve as your unique identification to the session.
A session is automatically closed when no client interacts with it for some time. Interaction can be as simple as requesting information from the session. However, your application is recognized as an interacting client if it does so providing its client token.


===Sessions===
===Sessions===

Revision as of 14:53, 22 April 2015

This article is a stub.

In Q2 2015 you can connect to the Tygron Engine via a REST API.

More info about rest can be found here

Specs

Session infrastructure

The Tygron Engine acts as a central server. On it, information regarding domains, users and projects is stored. To interact with a project (whether it's creating, editing or playing) the project must be started in the appropriate fashion on the server.

To start a session on the server, you must authenticate with appropriate credentials. You can then instruct the server to start your project in a variety of modes. After the session has started, you can request information regarding the session, including a server token with which you can interact with the session, and a client token which will serve as your unique identification to the session.

A session is automatically closed when no client interacts with it for some time. Interaction can be as simple as requesting information from the session. However, your application is recognized as an interacting client if it does so providing its client token.

Sessions

There are multiple events involved in having your application neatly interact with a session on the server.

IOServicesEventType.START_NEW_SESSION: This event starts a project on the server. No interaction takes place yet. If the project is already opened in Editor mode, it cannot be opened again, either in an Editor or as a playable game, until the session is closed. If the project has been opened in Single Player or Multiplayer mode, the project cannot be edited until all the playable sessions have closed.

IOServicesEventType.GET_ALL_SESSIONS: This event lists all currently running projects for your domain.

IOServicesEventType.JOIN_SESSION: This event provides you with tokens you can use to join the project. The serverToken is necessary to interact with the specific project. The clientToken identifies your program to the server, allowing it to recognize there is a client interacting with the project. If no clients interact with a project for too long, the sessions closes automatically.

IOServicesEventType.CLOSE_SESSION: This event lets the server know your application has left the session. This means any stakeholder you have selected is freed up for another client, and the server no longer considers your client part of the session. When all clients have left a session, the session is closed automatically.

IOServicesEventType.KILL_SESSION: This event terminates a session immediately.

Return codes

200: Success: This means the request was accepted.

406: Not Acceptable. This is returned when a request is made to an URL, requesting a format which cannot be returned. For example, the base URL of the api (api/) can be viewed in the browser, because it is returned in HTML, but will cause this statuscode when requested in JSON format.