Commit a687983bb844eba2f60852665ca641c7e3b2a1fe

Authored by Marcos Oliveira
1 parent 1bd47aaa

Validar item

Showing 1 changed file with 85 additions and 64 deletions
Readme.md
1 -Authenticate 1 +# Authenticate
2 2
3 -This method authenticate a player to your gamification and opens a session for the authenticated player on success. Authentication against the Funifier API is done with your gamification's API key, Authentication Mode and some combinations of credentials. GET Method 3 +This method authenticate a player to your gamification and opens a session for the authenticated player on success. Authentication against the Funifier API is done with your gamification's API key, Authentication Mode and some combinations of credentials.
  4 +GET Method
4 5
5 - api_key : String - Required  
6 - app_secret : String - Optional  
7 - auth_mode : String - Required  
8 - app_secret : String - Optional  
9 - auth_mode : String - Required  
10 - password : String - Optional  
11 - expiration : int- Optional  
12 - callback : String- Optional 6 +**Parameters** .
13 7
14 -Example Request 8 + - Parameter Type Required Description
  9 + - api_key - **String** Required
  10 + - app_secret- **String** Optional
  11 + - auth_mode- **String** Required
  12 + - app_secret- **String** Optional
  13 + - auth_mode- **String** Required
  14 + - password- **String** Optional
  15 + - expiration- **int** Optional
  16 + - callback- **String** Optional
15 17
  18 +### Example Request
  19 +```sh
16 https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=IMPLICIT&player=ricardo@funifier.com 20 https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=IMPLICIT&player=ricardo@funifier.com
17 - 21 +```
  22 +```sh
18 $ https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=PASSWORD&player=ricardo@funifier.com&password=123 23 $ https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=PASSWORD&player=ricardo@funifier.com&password=123
19 - 24 +```
  25 +```sh
20 $ mhttps://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=CREDENTIAL&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326 26 $ mhttps://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=CREDENTIAL&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326
  27 +```
  28 +### Example Response
21 29
22 -Example Response  
23 - 30 +```sh
24 {"message" : "action tracked","code" : 200,"type" : "OK"} 31 {"message" : "action tracked","code" : 200,"type" : "OK"}
  32 +```
  33 +### Example Response
25 34
26 -Example Response  
27 - 35 +```sh
28 {"access_token" : "54d80a14e4b0e8d184586a1c"} 36 {"access_token" : "54d80a14e4b0e8d184586a1c"}
29 -  
30 -Example Error  
31 - 37 +```
  38 +### Example Error
  39 +```
32 {"message" : "player ricardo@funifier.com does not exist, ask your administrator to create it in studio.funifier.com","code" : 401,"type" : "Unauthorized"} 40 {"message" : "player ricardo@funifier.com does not exist, ask your administrator to create it in studio.funifier.com","code" : 401,"type" : "Unauthorized"}
33 -  
34 -Track  
35 -  
36 - This method send actions performed by players to Funifier. Requires you to call this method whenever the action occurs, and pass the action name, and all the metadata you care about. 41 +```
  42 +### Track
  43 + - This method send actions performed by players to Funifier. Requires you to call this method whenever the action occurs, and pass the action name, and all the metadata you care about.
37 44
38 POST Method 45 POST Method
39 46
  47 +```
40 ### http[s]://service2.funifier.com/2.0.0/track 48 ### http[s]://service2.funifier.com/2.0.0/track
41 -  
42 - api_key: String- Required  
43 - access_token: String- Optional  
44 - player: String- Optional  
45 - app_secret: String- Optional  
46 - action: String- Required  
47 - attributes: String Optional Description Json Object, ( Example: {"attribute1":"value1", - - - - "attribute2":"value2"})  
48 - timestamp: long- Optional  
49 - callback: String- Optional  
50 -  
51 -Example Request  
52 - 49 +```
  50 + - Parameter Type Required Description
  51 + - api_key **String** Required
  52 + - access_token **String** Optional
  53 + - player **String** Optional
  54 + - app_secret **String** Optional
  55 + - action **String** Required
  56 + - attributes **String** Optional **Description** Json Object,
  57 + (** Example: {"attribute1":"value1", - - - - "attribute2":"value2"}**)
  58 + - timestamp long Optional
  59 + - callback String Optional
  60 +
  61 +### Example Request
  62 +
  63 +```sh
53 https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&access_token=54d8139ae4b0e8d184586a1f 64 https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&access_token=54d8139ae4b0e8d184586a1f
54 - 65 +```
  66 +```sh
55 https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326 67 https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326
56 -  
57 -Example Response  
58 - 68 +```
  69 +### Example Response
  70 +```sh
59 {"message" : "action tracked","code" : 200,"type" : "OK"} 71 {"message" : "action tracked","code" : 200,"type" : "OK"}
60 -  
61 -Widget Data 72 +```
  73 +### Widget Data
62 74
63 This method retrieves information about players, win-states, incentives and other objects inside the gamification. Use this to show to visually engage the players with their status and other infos. 75 This method retrieves information about players, win-states, incentives and other objects inside the gamification. Use this to show to visually engage the players with their status and other infos.
64 76
65 GET Method 77 GET Method
66 - 78 +```sh
67 http[s]://service2.funifier.com/2.0.0/get_widget_data 79 http[s]://service2.funifier.com/2.0.0/get_widget_data
68 -  
69 -Parameters  
70 -  
71 - api_key: String- Required  
72 - access_token: String- Optional  
73 - player: String- Optional  
74 - app_secret: String- Optional  
75 - include_teams: boolean- Optional  
76 - include_levels: boolean- Optional  
77 - include_challenges: boolean- Optional  
78 - include_catalogs: boolean- Optional  
79 - include_leaderboards: boolean- Optional  
80 - include_friends: boolean- Optional  
81 - include_actions: boolean- Optional  
82 - include_points: boolean- Optional  
83 - include_game: boolean- Optional  
84 - callback: String- Optional  
85 - 80 +```
  81 +## Parameters
  82 +
  83 +- Parameter Type Required Description
  84 +- api_key **String** Required
  85 +- access_token **String** Optional
  86 +- player **String** Optional
  87 +- app_secret **String** Optional
  88 +- include_teams **boolean** Optional
  89 +- include_levels **boolean** Optional
  90 +- include_challenges **boolean** Optional
  91 +- include_catalogs **boolean** Optional
  92 +- include_leaderboards **boolean** Optional
  93 +- include_friends **boolean** Optional
  94 +- include_actions **boolean** Optional
  95 +- include_points **boolean**Optional
  96 +- include_game **boolean** Optional
  97 +- callback **String** Optional
  98 +-
86 Example Request 99 Example Request
87 100
88 - https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&access_token=54d8139ae4b0e8d184586a1f&include_challenges=true  
89 101
90 -https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326&include_challenges=true  
91 102
92 -Example Response 103 +##Example Response
  104 +```sh
  105 + https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&access_token=54d8139ae4b0e8d184586a1f&include_challenges=true
  106 +```
93 107
  108 +```sh
  109 +https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326&include_challenges=true
  110 +```
  111 +##Example Response
  112 +```sh
94 {"player":{"name" : "Ricardo Lopes Costa","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"total_challenges" : 2,"challenges" : {"54d8098034282de65297817a" : 1,"54d809dc34282de65297822f" : 1},"total_points" : 25,"point_categories" : {"54d8064034282de652977c52" : 25},"total_catalog_items" : 1,"catalog_items" : {"54d8077c34282de652977e7f" : 1},"level_progress" : {"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8067e34282de652977cb6"},"percent_completed" : 2.5,"next_points" : 975,"next_level" : {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8069734282de652977cf0"},"total_levels" : 2,"percent" : 2.5},"challenge_progress" : [ ],"teams" : [ "54d806c134282de652977d65", "54d806d534282de652977d9e", "54d806e934282de652977df8" ],"friends" : [ "esau@funifier.com" ],"positions" : [ ],"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8067e34282de652977cb6"},"_id" : "ricardo.lopes.costa@gmail.com"},"teams":[ {"name" : "Brazil","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806c134282de652977d65"}, {"name" : "Canada","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806d534282de652977d9e"}, {"name" : "Mexico","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806e934282de652977df8"} ],"levels":[ {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"}, {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8069734282de652977cf0"} ],"challenges":[ {"challenge" : "Big Sales Hero","description" : "You are a sales hero for closing a big opportunity of $100.000. enjoy this reward as you have earned the right to be recognized as a \"big sales hero\". PS. enjoy the commission cheque!","range" : 0,"active" : true,"rules" : [ {"actionId" : "54d8088c34282de652978027","position" : 1,"operator" : 5,"total" : 0,"timeAmount" : 0,"timeScale" : 0,"outOfTime" : false,"everyAmount" : 0,"everyScale" : 0,"filters" : [ {"value" : "100000","operator" : 5,"param" : "price"} ],"_id" : "54d8098034282de652978179"} ],"triggerUrl" : "","teamChallenge" : false,"limitTotal" : 1,"limitPerType" : 0,"limitTimeAmount" : 1,"limitTimeScale" : 5,"badge" : {"medium" : {"url" : "http://funifier.com/image.png"}},"hideUntilEarned" : false,"points" : [ {"total" : 10,"category" : "54d8064034282de652977c52","operation" : 0} ],"notifications" : [ {"event" : 0,"type" : 0,"scope" : 0,"content" : "{} completed {}"} ],"items" : [ "54d8077c34282de652977e7f" ],"tags" : [ ],"triggerURL" : "","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8098034282de65297817a"}, {"challenge" : "Lead Start","description" : "Register your first lead in the system to earn this badge. Use the system well is a good way to start your sales career and earn 5 experiences points.","range" : 0,"active" : true,"rules" : [ {"actionId" : "54d808a634282de65297805f","position" : 1,"operator" : 5,"total" : 0,"timeAmount" : 0,"timeScale" : 0,"outOfTime" : false,"everyAmount" : 0,"everyScale" : 0,"filters" : [ ],"_id" : "54d809dc34282de65297822e"} ],"triggerUrl" : "","teamChallenge" : false,"limitTotal" : 1,"limitPerType" : 0,"limitTimeAmount" : 0,"limitTimeScale" : 0,"badge" : {"medium" : {"url" : "http://funifier.com/image.png"}},"principals" : [ ],"hideUntilEarned" : false,"points" : [ {"total" : 15,"category" : "54d8064034282de652977c52","operation" : 0} ],"notifications" : [ {"event" : 0,"type" : 0,"scope" : 0,"content" : "{} completed {}"} ],"items" : [ ],"triggerURL" : "","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d809dc34282de65297822f"} ], "catalogs":[ {"catalog" : "Privilegies","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8070c34282de652977e3c"} ],"catalog_items":[ {"catalogId" : "54d8070c34282de652977e3c","name" : "Parking Place","description" : "Access to the private parking lot of the company for one month.","points" : [ {"total" : 100,"category" : "54d8064034282de652977c52","operation" : 0} ],"amount" : 100,"maxPerUser" : 10,"levelId" : "","active" : true,"real" : false,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"owned" : 0,"_id" : "54d8077c34282de652977e7f"}, {"catalogId" : "54d8070c34282de652977e3c","name" : "Home-Office","description" : "Being able to work a full day without leaving home.","points" : [ {"total" : 121,"category" : "54d8064034282de652977c52","operation" : 0} ],"amount" : 200,"maxPerUser" : 20,"levelId" : "","active" : true,"real" : false,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"owned" : 0,"_id" : "54d807e834282de652977efa"} ],"friends":[ {"name" : "Esau de Paula Freitas","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"total_challenges" : 1,"challenges" : {"54d809dc34282de65297822f" : 1},"total_points" : 15,"point_categories" : {"54d8064034282de652977c52" : 15},"total_catalog_items" : 0,"catalog_items" : { },"level_progress" : {"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"},"percent_completed" : 1.5,"next_points" : 985,"next_level" : {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8069734282de652977cf0"},"total_levels" : 2,"percent" : 1.5},"challenge_progress" : [ ],"teams" : [ "54d806c134282de652977d65" ],"friends" : [ "ricardo.lopes.costa@gmail.com" ],"positions" : [ ],"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"},"_id" : "esau@funifier.com"} ]} 113 {"player":{"name" : "Ricardo Lopes Costa","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"total_challenges" : 2,"challenges" : {"54d8098034282de65297817a" : 1,"54d809dc34282de65297822f" : 1},"total_points" : 25,"point_categories" : {"54d8064034282de652977c52" : 25},"total_catalog_items" : 1,"catalog_items" : {"54d8077c34282de652977e7f" : 1},"level_progress" : {"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8067e34282de652977cb6"},"percent_completed" : 2.5,"next_points" : 975,"next_level" : {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8069734282de652977cf0"},"total_levels" : 2,"percent" : 2.5},"challenge_progress" : [ ],"teams" : [ "54d806c134282de652977d65", "54d806d534282de652977d9e", "54d806e934282de652977df8" ],"friends" : [ "esau@funifier.com" ],"positions" : [ ],"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"notifications" : null,"requirements" : null,"_id" : "54d8067e34282de652977cb6"},"_id" : "ricardo.lopes.costa@gmail.com"},"teams":[ {"name" : "Brazil","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806c134282de652977d65"}, {"name" : "Canada","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806d534282de652977d9e"}, {"name" : "Mexico","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d806e934282de652977df8"} ],"levels":[ {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"}, {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8069734282de652977cf0"} ],"challenges":[ {"challenge" : "Big Sales Hero","description" : "You are a sales hero for closing a big opportunity of $100.000. enjoy this reward as you have earned the right to be recognized as a \"big sales hero\". PS. enjoy the commission cheque!","range" : 0,"active" : true,"rules" : [ {"actionId" : "54d8088c34282de652978027","position" : 1,"operator" : 5,"total" : 0,"timeAmount" : 0,"timeScale" : 0,"outOfTime" : false,"everyAmount" : 0,"everyScale" : 0,"filters" : [ {"value" : "100000","operator" : 5,"param" : "price"} ],"_id" : "54d8098034282de652978179"} ],"triggerUrl" : "","teamChallenge" : false,"limitTotal" : 1,"limitPerType" : 0,"limitTimeAmount" : 1,"limitTimeScale" : 5,"badge" : {"medium" : {"url" : "http://funifier.com/image.png"}},"hideUntilEarned" : false,"points" : [ {"total" : 10,"category" : "54d8064034282de652977c52","operation" : 0} ],"notifications" : [ {"event" : 0,"type" : 0,"scope" : 0,"content" : "{} completed {}"} ],"items" : [ "54d8077c34282de652977e7f" ],"tags" : [ ],"triggerURL" : "","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8098034282de65297817a"}, {"challenge" : "Lead Start","description" : "Register your first lead in the system to earn this badge. Use the system well is a good way to start your sales career and earn 5 experiences points.","range" : 0,"active" : true,"rules" : [ {"actionId" : "54d808a634282de65297805f","position" : 1,"operator" : 5,"total" : 0,"timeAmount" : 0,"timeScale" : 0,"outOfTime" : false,"everyAmount" : 0,"everyScale" : 0,"filters" : [ ],"_id" : "54d809dc34282de65297822e"} ],"triggerUrl" : "","teamChallenge" : false,"limitTotal" : 1,"limitPerType" : 0,"limitTimeAmount" : 0,"limitTimeScale" : 0,"badge" : {"medium" : {"url" : "http://funifier.com/image.png"}},"principals" : [ ],"hideUntilEarned" : false,"points" : [ {"total" : 15,"category" : "54d8064034282de652977c52","operation" : 0} ],"notifications" : [ {"event" : 0,"type" : 0,"scope" : 0,"content" : "{} completed {}"} ],"items" : [ ],"triggerURL" : "","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d809dc34282de65297822f"} ], "catalogs":[ {"catalog" : "Privilegies","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8070c34282de652977e3c"} ],"catalog_items":[ {"catalogId" : "54d8070c34282de652977e3c","name" : "Parking Place","description" : "Access to the private parking lot of the company for one month.","points" : [ {"total" : 100,"category" : "54d8064034282de652977c52","operation" : 0} ],"amount" : 100,"maxPerUser" : 10,"levelId" : "","active" : true,"real" : false,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"owned" : 0,"_id" : "54d8077c34282de652977e7f"}, {"catalogId" : "54d8070c34282de652977e3c","name" : "Home-Office","description" : "Being able to work a full day without leaving home.","points" : [ {"total" : 121,"category" : "54d8064034282de652977c52","operation" : 0} ],"amount" : 200,"maxPerUser" : 20,"levelId" : "","active" : true,"real" : false,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"owned" : 0,"_id" : "54d807e834282de652977efa"} ],"friends":[ {"name" : "Esau de Paula Freitas","image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"total_challenges" : 1,"challenges" : {"54d809dc34282de65297822f" : 1},"total_points" : 15,"point_categories" : {"54d8064034282de652977c52" : 15},"total_catalog_items" : 0,"catalog_items" : { },"level_progress" : {"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"},"percent_completed" : 1.5,"next_points" : 985,"next_level" : {"level" : "Advanced","position" : 1,"description" : "Advanced level description","minPoints" : 1000,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8069734282de652977cf0"},"total_levels" : 2,"percent" : 1.5},"challenge_progress" : [ ],"teams" : [ "54d806c134282de652977d65" ],"friends" : [ "ricardo.lopes.costa@gmail.com" ],"positions" : [ ],"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"},"_id" : "esau@funifier.com"} ]}
  114 +```
  115 +
95 116