Blame view

rest/Readme.md 12.1 KB
a687983b   Marcos Oliveira   Validar item
1
  # Authenticate

2e410466   esau   versão inicial do...
2
  

a687983b   Marcos Oliveira   Validar item
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.

e8b18f54   Esaú Freitas   ajustes
4
  

a687983b   Marcos Oliveira   Validar item
5
  GET Method

2e410466   esau   versão inicial do...
6
  

e8b18f54   Esaú Freitas   ajustes
7
  ```sh

61b07590   Esaú Freitas   ajustes
8
  http[s]://service2.funifier.com/2.0.0/authenticate

e8b18f54   Esaú Freitas   ajustes
9
10
  ```	

  

a687983b   Marcos Oliveira   Validar item
11
  **Parameters** .

2e410466   esau   versão inicial do...
12
  

e8b18f54   Esaú Freitas   ajustes
13
14
15
16
17
18
19
20
21
   - api_key: **String/Required** - Field that identify the key of gamification

   - auth_mode: **String/Required** - Identify which method of authentication will use. The values can be [IMPLICIT,PASSWORD,CREDENTIAL,FACEBOOK]

   - oauth_access_token: **String/Optional** - Use this field when the auth_mode is FACEBOOK. This value is the Facbook Token

   - player: **String/Required** - Identify the Player of gamification

   - app_secret: **String/Optional** - Token security, create this app_secret value in funfier studio on menu security

   - password: **String/Optional** - Use this field when the auth_mode authentication is PASSWORD

   - expiration: **int/Optional** - Used to define expirations time in seconds of sessions

   - language: **int/Optional** - Set the default language in authentication

   - callback: **String/Optional** - Use to callbacks in javascript 

2e410466   esau   versão inicial do...
22
  

a687983b   Marcos Oliveira   Validar item
23
24
  ### Example Request

  ```sh

61b07590   Esaú Freitas   ajustes
25
  https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=IMPLICIT&player=player@funifier.com

a687983b   Marcos Oliveira   Validar item
26
27
  ```	

  ```sh

61b07590   Esaú Freitas   ajustes
28
  https://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=PASSWORD&player=player@funifier.com&password=123

a687983b   Marcos Oliveira   Validar item
29
30
  ```	

  ```sh

61b07590   Esaú Freitas   ajustes
31
  mhttps://service2.funifier.com/2.0.0/authenticate?api_key=556df789108d44a65c389583&auth_mode=CREDENTIAL&player=player@funifer.com&app_secret=54d80b7f34282de652978326

a687983b   Marcos Oliveira   Validar item
32
  ```

2e410466   esau   versão inicial do...
33
  

61b07590   Esaú Freitas   ajustes
34
  ### Example Response Sucess

2e410466   esau   versão inicial do...
35
  

a687983b   Marcos Oliveira   Validar item
36
  ```sh

2e410466   esau   versão inicial do...
37
  {"access_token" : "54d80a14e4b0e8d184586a1c"}

a687983b   Marcos Oliveira   Validar item
38
  ```	

61b07590   Esaú Freitas   ajustes
39
  ### Example Response Error 

a687983b   Marcos Oliveira   Validar item
40
  ```

61b07590   Esaú Freitas   ajustes
41
  {"message" : "player player@funifier.com does not exist, ask your administrator to create it in studio2.funifier.com","code" : 401,"type" : "Unauthorized"}

a687983b   Marcos Oliveira   Validar item
42
  ```	

61b07590   Esaú Freitas   ajustes
43
44
45
46
  

  # Track

  

  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.

2e410466   esau   versão inicial do...
47
48
49
  

  POST Method

  

61b07590   Esaú Freitas   ajustes
50
  ```sh

ac49eb19   Marcos Oliveira   Validar
51
  http[s]://service2.funifier.com/2.0.0/track

a687983b   Marcos Oliveira   Validar item
52
  ```

8c5d2324   Marcos Oliveira   validar
53
  

61b07590   Esaú Freitas   ajustes
54
55
56
57
58
59
60
61
   - api_key: **String/Required** - Field that identify the key of gamification	

   - access_token: **String/Required** - This field authorize the player to request this method, This value can be obtain by method Authenticate 

   - player: **String/Required** - Identify the Player of gamification	

   - app_secret: **String/Optional** - Token security, create this app_secret value in funfier studio on menu security	

   - action: **String/Required** - This field identifies the action that will be registered

   - attributes:	**String/Optional** - In This field can be past the objects of action. It is a Json Object. e.g. {"attribute1":"value1", "attribute2":"value2"}

   - timestamp: **long/Optional** - This field is used to define a date. The type is a long

   - callback: **String/Optional** - Use to callbacks in javascript	

a687983b   Marcos Oliveira   Validar item
62
63
64
65
  

  ### Example Request

  

  ```sh

2e410466   esau   versão inicial do...
66
  https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&access_token=54d8139ae4b0e8d184586a1f

a687983b   Marcos Oliveira   Validar item
67
68
  ```	

  ```sh

61b07590   Esaú Freitas   ajustes
69
  https://service2.funifier.com/2.0.0/track?api_key=556df789108d44a65c389583&action=sell&attributes={"product":"book","price":12.5}&player=player@funifier.com&app_secret=54d80b7f34282de652978326

a687983b   Marcos Oliveira   Validar item
70
  ```	

61b07590   Esaú Freitas   ajustes
71
  ### Example Response Sucess

a687983b   Marcos Oliveira   Validar item
72
  ```sh

2e410466   esau   versão inicial do...
73
  {"message" : "action tracked","code" : 200,"type" : "OK"}

a687983b   Marcos Oliveira   Validar item
74
  ```	

61b07590   Esaú Freitas   ajustes
75
76
77
78
79
80
  ### Example Response Error

  ```

  {"message" : "action sell does not exist","code" : 400, "type" : "Bad Request"}

  ```

  

  # Widget Data

2e410466   esau   versão inicial do...
81
82
83
84
  

  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.

  

  GET Method

a687983b   Marcos Oliveira   Validar item
85
  ```sh

2e410466   esau   versão inicial do...
86
  http[s]://service2.funifier.com/2.0.0/get_widget_data

a687983b   Marcos Oliveira   Validar item
87
88
89
  ```	

  ## Parameters

  

8c5d2324   Marcos Oliveira   validar
90
  

48d01537   Marcos Oliveira   validar
91
92
93
94
   - api_key: **String/Required** - Field that identify the key of gamification

   - oauth_access_token: **String/Optional** - Use this field when the auth_mode is FACEBOOK. This value is the Facbook Token

   - player: **String/Required** - Identify the Player of gamification

   - app_secret: **String/Optional** - Token security, create this app_secret value in funfier studio on menu security

4c448505   Esaú Freitas   ajustes
95
96
97
98
99
100
101
   - include_teams: **boolean/Optional** - If value is true, the list of teams will be loaded	

   - include_levels: **boolean/Optional** - If value is true, the list of levels will be loaded			

   - include_challenges: **boolean/Optional**	 If value is true, the list of challenges will be loaded		

   - include_catalogs: **boolean/Optional** - If value is true, the list of catalogs will be loaded	

   - include_leaderboards: **boolean/Optional** - If value is true, the list of leaderboards will be loaded	

   - include_friends: **boolean/Optional** - If value is true, the list of friends will be loaded	

   - include_actions: **boolean/Optional** - If value is true, the list of actions will be loaded	

93849902   Esaú Freitas   incluido parametr...
102
103
   - include_points: **boolean/Optional** - If value is true, the list of points will be loaded

   - include_game: **boolean/Optional** - If value is true, the game generic stats will be loaded

4c448505   Esaú Freitas   ajustes
104
   - callback: **String/Optional** - Use to callbacks in javascript 

a28adef4   Marcos Oliveira   Validar
105
  

5cd8ac21   Marcos Oliveira   validar
106
  # Example Response

a687983b   Marcos Oliveira   Validar item
107
108
109
  ```sh

  	https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&access_token=54d8139ae4b0e8d184586a1f&include_challenges=true

  ```	

1bd47aaa   Marcos Oliveira   modificação direta
110
  

a687983b   Marcos Oliveira   Validar item
111
  ```sh

5cd8ac21   Marcos Oliveira   validar
112
      https://service2.funifier.com/2.0.0/get_widget_data?api_key=556df789108d44a65c389583&player=ricardo@funifier.com&app_secret=54d80b7f34282de652978326&include_challenges=true

a687983b   Marcos Oliveira   Validar item
113
  ```

01d9a68f   Marcos Oliveira   Validar
114
  ## Example Response

a687983b   Marcos Oliveira   Validar item
115
  ```sh

4c448505   Esaú Freitas   ajustes
116
  {"player":{"name" : "Player Name","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" : [ "player@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" : "player@funifier.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" : "Player Name","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" : [ "player2@funifier.com" ],"positions" : [ ],"level" : {"level" : "Rookie","position" : 0,"description" : "Rookie level description","minPoints" : 10,"image" : {"medium" : {"url" : "http://funifier.com/image.png"}},"_id" : "54d8067e34282de652977cb6"},"_id" : "player@funifier.com"} ]}

ac49eb19   Marcos Oliveira   Validar
117
  ```