| 1 | = Cinnamon API Conceptual Description |
| 2 | == Accessing the Cinnamon API |
| 3 | All Cinnamon functions that are part of user interaction, e. g. using [wiki:Docs/CinnamonDesktopClient Cinnamon Desktop Client (CDCplus)], are exposed by Cinnamon Server through an [https://www.w3schools.com/whatis/whatis_http.asp HTTP] based API (Application Programming Interface). |
| 4 | |
| 5 | Cinnamon API sessions begin with a {{{connect}}} command which returns a {{{ticket}}} value if successful. Further API commands require the returned {{{ticket}}} as a parameter to associate the command with an existing session. A session ends with the {{{disconnect}}} command. |
| 6 | |
| 7 | Cinnamon Server runs in Apache Tomcat which, by default, listens on port 8080. This can be changed in the Apache Tomcat configuration, if desired. |
| 8 | |
| 9 | The Cinnamon API used in current applications is the so-called //legacy// API. The term //legacy// had been introduced in the past to distinguish it from another API the server, at that time, exposed. In fact, in current Cinnamon releases, the //legacy// API is the actual API of the system. The path to the legacy API is /cinnamon/cinnamon/legacy. |
| 10 | |
| 11 | Thus, the API URL of a Cinnamon Server is typically: |
| 12 | {{{ |
| 13 | http://<ip-address>:8080/cinnamon/cinnamon/legacy |
| 14 | }}} |
| 15 | |
| 16 | > **NOTE:** The Cinnamon Server in default configuration is exposed through an unencrypted http address. In real-life scenarios, Cinnamon Server is either inside a VPN (but even in this case, using https often makes sense), or it is behind a proxy using a certificate and pointing to port 8080 of the target system. In such cases, Cinnamon Server addresses look like this: |
| 17 | {{{ |
| 18 | https://mycompany.cinnamon-hosting.de/cinnamon/cinnamon/legacy |
| 19 | }}} |
| 20 | |
| 21 | == Request types |
| 22 | See reference (2) for sample code (in C#). |
| 23 | |
| 24 | === GET requests |
| 25 | A GET request to the Cinnamon Server returns some basic information on the system: |
| 26 | {{{#!xml |
| 27 | <repositories> |
| 28 | <repository> |
| 29 | <name>content</name> |
| 30 | <categories> |
| 31 | <category>production</category> |
| 32 | </categories> |
| 33 | </repository> |
| 34 | <version>3.8.0</version> |
| 35 | <build>77</build> |
| 36 | </repositories> |
| 37 | }}} |
| 38 | |
| 39 | The category settings can be configured on the server as required. Clients can use this information to distinguish their behaviour. |
| 40 | |
| 41 | === POST without content operation |
| 42 | Most API commands are of this category: they read or write information, but do not access the content. |
| 43 | |
| 44 | === POST with file upload |
| 45 | Some API commands create or change content in the system. In this case, the content must be uploaded as part of the POST request. |
| 46 | |
| 47 | === POST with file download |
| 48 | The {{{getcontent}}} command is the only API command that retrieves content from the repository. The response of {{{getcontent}}} is therefore the content file requested instead of an XML response. |
| 49 | |
| 50 | == References |
| 51 | * (1) [wiki:Docs/CinnamonApi Cinnamon API Command Reference] |
| 52 | * (2) [https://sourceforge.net/p/cinnamon/code/HEAD/tree/Client/trunk/NativeApiServerConnector/ServerCommandInterface.cs Source code of ServerCommandInterface.cs] |