{"_id":"5a55b149f85c3a0032f10e5e","category":"5a55b149f85c3a0032f10e56","project":"550dd1756c0b4c0d00fd436e","user":"5514315e67d97f2500b774ed","parentDoc":null,"version":"5a55b149f85c3a0032f10e55","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-05-10T12:20:13.928Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"The Spigo Platform offers a two-way API based on REST, with JSON as data format. The API has quite a number of events. However, just a small fraction of them are mandatory allowing you an easy a hassle free integration. For single- and multiplayer casual games you just need to implement responses to seven callbacks.\n[block:parameters]\n{\n \"data\": {\n \"0-0\": \"isPlayerLoggedIn\",\n \"4-0\": \"checkValidRequest\",\n \"5-0\": \"jackpotPayout\",\n \"6-0\": \"gameSessionEnd\",\n \"7-0\": \"\",\n \"8-0\": \"\",\n \"9-0\": \"\",\n \"10-0\": \"\",\n \"11-0\": \"\",\n \"12-0\": \"\",\n \"1-0\": \"getPlayerBalance\",\n \"2-0\": \"gameRequestBuy\",\n \"3-0\": \"requestRefund\",\n \"h-0\": \"Action name\",\n \"h-1\": \"Description\",\n \"0-1\": \"Sent by Spigo to check if a player is logged in to the casino site.\",\n \"1-1\": \"Sent by Spigo to ask what a player's balance is.\",\n \"2-1\": \"Sent by Spigo to place a bet (withdraw money from the wallet).\",\n \"3-1\": \"Sent by Spigo to refund a placed bet.\",\n \"4-1\": \"Sent by Spigo to determine whether a timed out refund request was carried out.\",\n \"5-1\": \"Sent by Spigo to payout a jackpot prize.\",\n \"6-1\": \"Sent by Spigo to end a game and payout winnings.\"\n },\n \"cols\": 2,\n \"rows\": 7\n}\n[/block]\nThe state diagram below shows how these seven events are called as the player performs actions in the GameHub and plays single- and multiplayer games.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/0w4bE2MNTLehwgMrYpkf_Single-%20and%20Multiplayer%20game%20API.png\",\n \"Single- and Multiplayer game API.png\",\n \"1760\",\n \"1360\",\n \"#646464\",\n \"\"\n ],\n \"caption\": \"Single- and multiplayer game API. Click to enlarge.\"\n }\n ]\n}\n[/block]\nTo add slot machines you need a mere two extra events.\n[block:parameters]\n{\n \"data\": {\n \"0-0\": \"gameSessionRequestBuy\",\n \"1-0\": \"gameSessionDeposit\",\n \"h-0\": \"Action name\",\n \"h-1\": \"Description\",\n \"0-1\": \"Sent by Spigo to start a slot machine session. No money is withdrawn.\",\n \"1-1\": \"Sent by Spigo to payout winnings during a slot machine session.\"\n },\n \"cols\": 2,\n \"rows\": 2\n}\n[/block]\nThis produces a slightly more complex event flow. However, once the game is started from an API perspective it is almost exclusively a sequence of alternating gameSessionRequestBuy and gameSessionDeposit events.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/gEW8zbLVRG2kr4XJZq7s_Slotmachine%20game%20API.png\",\n \"Slotmachine game API.png\",\n \"1760\",\n \"1360\",\n \"#999999\",\n \"\"\n ],\n \"caption\": \"Slotmachine game API. Click to enlarge.\"\n }\n ]\n}\n[/block]","excerpt":"","slug":"api-integration-overview","type":"basic","title":"API integration overview","__v":0,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]}