Last modified by Rayaan Ahmed on 2025/02/09 22:20

From version 10.1
edited by Rayaan Ahmed
on 2024/02/27 18:43
Change comment: There is no comment for this version
To version 13.1
edited by Rayaan Ahmed
on 2025/02/03 19:55
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -58,6 +58,7 @@
58 58  11. Get specific engagement by engagement id
59 59  11. Create Engagements
60 60  11. Update Engagements
61 +11. Add options to metric for an engagement
61 61  11. Add users data to Engagement
62 62  1. Segments
63 63  11. Get all Segments
... ... @@ -147,13 +147,13 @@
147 147  === **COMPONENT: Users** ===
148 148  
149 149  (% class="western" %)
150 -Users means the customers of your system. Users can be added, updated and searched for using the users resource from the api. For lookup, If a return parameter is specified Users object will have those fields. If nothing is specified by default only UserId is returned.
151 +Users means the customers of your system. Users can be added, updated and searched for using the users resource from the api. For lookup, If a return parameter is specified Users JSON object will have those fields. If nothing is specified by default only UserId is returned.
151 151  
152 152  (% class="western" %)
153 153  Additionally (Array of) transaction object specifying parts of the transaction to be added to the new user can be specified. UserId, TransactionId and SubscriptionType will be ignored if specified for this case. As this is new user and new transaction is being added.
154 154  
155 155  (% class="western" %)
156 -In this case the provided demographic information in users object will be used to create a new user in ONEcount and then a response will be generated. Before creating a new user, a check for duplicate will be performed based on Dedupe columns and if found, and error code will be generated.
157 +In this case the provided demographic information in users JSON object will be used to create a new user in ONEcount and then a response will be generated. Before creating a new user, a check for duplicate will be performed based on Dedupe columns and if found, and error code will be generated.
157 157  
158 158  (% class="western" %)
159 159  If username and password is not one of the parameters being passed, then a random username and password will be generated for the user while creating his user account in ONEcount.
... ... @@ -235,7 +235,25 @@
235 235  Create a new users
236 236  
237 237  (% class="western" %)
238 -Parameters required to create the user needs to be sent as post data in JSON format.
239 +Parameters required to create the user needs to be sent as post data in JSON format. Below is the example of data
240 +\\Example:
241 +
242 +(% class="western" %)
243 +{"Users":{"PartnerId":1,"Demo":{"1":"rayaan@onecount.net","4":"Rayaan","5":"Ahmed"}},"DedupeColumns":"1","Transactions":[],"Return":"4,5,1"}
244 +
245 +
246 +(% class="western" %)
247 +1) PartherId is required, this can be any integer value.
248 +
249 +(% class="western" %)
250 +2) Demo is required it contains JSON object of user demographic information key as demo id and value as actual information of user.
251 +
252 +(% class="western" %)
253 +3) DedupeColumn is required, this contains demo id as value, used to check duplicate user based on demo id.
254 +
255 +(% class="western" %)
256 +4) Transactions is required, If user does not have any transaction pass empty array if user has a transaction pass transaction JSON object. please refer transaction API body for JSON object.
257 +
239 239  )))
240 240  |(% style="text-align:left; vertical-align:top" %)(% style="text-align: left;vertical-align: top;" %)
241 241  (((
... ... @@ -311,10 +311,6 @@
311 311  
312 312  ----
313 313  
314 -{{panel bgColor="#D3D3D3" width="100%"}}
315 -(% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users
316 -{{/panel}}
317 -
318 318  === (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
319 319  
320 320  ----
... ... @@ -849,12 +849,6 @@
849 849  
850 850  ----
851 851  
852 -{{panel bgColor="#D3D3D3" width="100%"}}
853 - (% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users/(% style="color:#212121" %)~{~{OCID}}
854 -{{/panel}}
855 -
856 -=== (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
857 -
858 858  ----
859 859  
860 860  (% class="Text__TextContainer-sc-1kqigik-0 cEvDCP iauueY item-key sc-fznXWL" style="color:#212121" %)Appkey                                                                                                 (% class="Text__TextContainer-sc-1kqigik-0 iYynAw" style="color:#212121" %)~{~{ONECOUNT API KEY}}
... ... @@ -947,10 +947,6 @@
947 947  
948 948  ----
949 949  
950 -{{panel bgColor="#D3D3D3" width="100%"}}
951 - (% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users(% class="nolink" style="color:#212121" %)/login
952 -{{/panel}}
953 -
954 954  === (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
955 955  
956 956  ----
... ... @@ -1021,10 +1021,6 @@
1021 1021  
1022 1022  ----
1023 1023  
1024 -{{panel bgColor="#D3D3D3" width="100%"}}
1025 -(% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users(% class="nolink" style="color:#212121" %)/lookup?2=user_242_6298&return=1,2,3,4
1026 -{{/panel}}
1027 -
1028 1028  === (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
1029 1029  
1030 1030  ----
... ... @@ -1101,10 +1101,6 @@
1101 1101  
1102 1102  ----
1103 1103  
1104 -{{panel bgColor="#D3D3D3" width="100%"}}
1105 -(% class="nolink nolink" %)https:~/~/api.onecount.net/v2(% class="nolink" style="color:#212121" %)/users/~{~{OCID}}/partners/~{~{Partner id}}
1106 -{{/panel}}
1107 -
1108 1108  === (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
1109 1109  
1110 1110  ----
... ... @@ -1116,11 +1116,7 @@
1116 1116  
1117 1117  ----
1118 1118  
1119 -{{panel bgColor="#D3D3D3" width="100%"}}
1120 -(% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users
1121 -{{/panel}}
1122 1122  
1123 -
1124 1124  (% class="western" %)
1125 1125  **POST method should be used to create users.**
1126 1126  
... ... @@ -1149,7 +1149,7 @@
1149 1149  )))|(% style="text-align:left; vertical-align:top" %)(% style="text-align: left;vertical-align: top;" %)
1150 1150  (((
1151 1151  (% class="western" %)
1152 -Users object that contains information about user to create. PartnerId Needs to be specified.
1145 +Users object that contains information about user to create. PartnerId Needs to be specified. PartnerId is any integer value.
1153 1153  )))
1154 1154  |(% style="text-align:left; vertical-align:top" %)(% style="text-align: left;vertical-align: top;" %)
1155 1155  (((
... ... @@ -1289,11 +1289,7 @@
1289 1289  
1290 1290  ----
1291 1291  
1292 -{{panel bgColor="#D3D3D3" width="100%"}}
1293 - (% class="nolink nolink" %)https:~/~/api.onecount.net/v2/users/~{~{OCID(% class="nolink" %)}}
1294 -{{/panel}}
1295 1295  
1296 -
1297 1297  (% class="western" %)
1298 1298  **PUT method should be used to update users.**
1299 1299  
... ... @@ -1621,6 +1621,9 @@
1621 1621  
1622 1622  (% class="western" %)
1623 1623  JSON of the Questions type object needs to be sent as post data. Id field is mandatory for update.
1613 +
1614 +(% class="western" %)
1615 +NOTE: While updating a select and checkbox type question you need to pass complete set of Choices for that question including the one which are already existing. If not the choices will be overwritten from the choices from the body.
1624 1624  )))
1625 1625  
1626 1626  (% id="HGETAllQuestions" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
... ... @@ -8136,8 +8136,9 @@
8136 8136  (% id="HPUTUpdatequestion" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
8137 8137  == (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#0053b8" %)PUT (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#212121" %)Update question(%%) ==
8138 8138  
8139 -----
8140 8140  
8132 +NOTE: While updating a select and checkbox type question you need to pass complete set of Choices for that question including the one which are already existing. If not the choices will be overwritten from the choices from the body.
8133 +
8141 8141  {{panel bgColor="#D3D3D3" width="100%"}}
8142 8142   (% class="nolink" %)https:~/~/api.onecount.net/v2(% style="color:#212121" %)/questions/~{~{QUESTION ID}}
8143 8143  {{/panel}}
... ... @@ -12868,7 +12868,16 @@
12868 12868  
12869 12869  (% class="western" %)
12870 12870  Parameters required to update the engagement needs to be sent as post data in JSON format.
12864 +
12865 +(% class="western" %)
12866 +NOTE: While updating a select and checkbox type question you need to pass complete set of Choices for that question including the one which are already existing. If not the choices will be overwritten from the choices from the body.
12871 12871  )))
12868 +|(% style="text-align:left; vertical-align:top" %)POST|(% style="text-align:left; vertical-align:top" %)/engagements/metric/<engagement id>|(% style="text-align:left; vertical-align:top" %)(((
12869 +Add options to specific metric in an engagement without passing all options and overriding existing options.
12870 +
12871 +Parameters required to update the engagement needs to be sent as post data in JSON format.
12872 +\\This API is used to add options only for select and checkbox metrics.
12873 +)))
12872 12872  |(% style="text-align:left; vertical-align:top" %)(% style="text-align: left;vertical-align: top;" %)
12873 12873  (((
12874 12874  (% class="western" %)
... ... @@ -13345,6 +13345,149 @@
13345 13345  {{/code}}
13346 13346  
13347 13347  
13350 +(% id="HPUTUpdateEngagement" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
13351 +== (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" id="cke_bm_7146126S" style="color:#0053b8; display:none" %) (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#ad7a03" %)POST(% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#0053b8" %) (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#212121" %)Add options to metric(%%) ==
13352 +
13353 +----
13354 +
13355 +{{panel bgColor="#D3D3D3" width="100%"}}
13356 + (% class="nolink" %)https:~/~/api.onecount.net/v2(%%)/engagements/metric/(% style="color:#212121" %)~{~{Engagement Id}}
13357 +{{/panel}}
13358 +
13359 +=== (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
13360 +
13361 +----
13362 +
13363 +(% class="Text__TextContainer-sc-1kqigik-0 cEvDCP iauueY item-key sc-fznXWL" style="color:#212121" %)Appkey                                                                                                 (% class="Text__TextContainer-sc-1kqigik-0 iYynAw" style="color:#212121" %)~{~{ONECOUNT API KEY}}
13364 +
13365 +=== (% style="color:#212121" %)Body (% style="color:#6b6b6b" %)raw (json)(%%) ===
13366 +
13367 +----
13368 +
13369 +{{code language="yml" title="Body"}}
13370 +{"Metrics":[
13371 + {"Attendance Status":[{"text":"checks","value":"checks"},{"text":"c","value":"c"}]},
13372 + {"lagacy status":[{"text":"c","value":"c"}]}
13373 + ]}
13374 +{{/code}}
13375 +
13376 +==== Example ====
13377 +
13378 +----
13379 +
13380 +(% style="color:#6b6b6b" %)Request
13381 +
13382 +{{code language="php" title="(% class=~"documentation-core-item-request-name jbmEtY sc-fzomuh~" style=~"color:#212121~" %)Add options to metric"}}
13383 + <?php
13384 +
13385 +$curl = curl_init();
13386 +
13387 +curl_setopt_array($curl, array(
13388 + CURLOPT_URL => 'https://api.onecount.net/v2/engagements/metric/{{Engagement Id}}',
13389 + CURLOPT_RETURNTRANSFER => true,
13390 + CURLOPT_ENCODING => '',
13391 + CURLOPT_MAXREDIRS => 10,
13392 + CURLOPT_TIMEOUT => 0,
13393 + CURLOPT_FOLLOWLOCATION => true,
13394 + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13395 + CURLOPT_CUSTOMREQUEST => 'PUT',
13396 + CURLOPT_POSTFIELDS =>'{"Metrics":[
13397 + {"Attendance Status":[{"text":"checks","value":"checks"},{"text":"c","value":"c"}]},
13398 + {"lagacy status":[{"text":"c","value":"c"}]}
13399 + ]}',
13400 + CURLOPT_HTTPHEADER => array(
13401 + 'Appkey: {{ONECOUNT API KEY}}',
13402 + 'Content-Type: application/json'
13403 + ),
13404 +));
13405 +
13406 +$response = curl_exec($curl);
13407 +
13408 +curl_close($curl);
13409 +echo $response;
13410 +
13411 +{{/code}}
13412 +
13413 +
13414 +(% style="color:#6b6b6b" %)Response  200 OK
13415 +
13416 +{{code language="yml" title="(% class=~"documentation-core-item-request-name jbmEtY sc-fzomuh~" style=~"color:#212121~" %)Add options to metric"}}
13417 +{
13418 + "result": {
13419 + "success": "1",
13420 + "error": {
13421 + "code": "",
13422 + "message": ""
13423 + }
13424 + },
13425 + "Engagements": [
13426 + {
13427 + "Id": "e0e816ec-77ba-4db1-bfc0-22d340337357",
13428 + "Name": "Test engagement 3",
13429 + "Metrics": [
13430 + {
13431 + "Name": "Attendance Status",
13432 + "Type": "select",
13433 + "Values": [
13434 + {
13435 + "text": "Attended",
13436 + "value": "attended"
13437 + },
13438 + {
13439 + "text": "Not Attended",
13440 + "value": "not_attended"
13441 + },
13442 + {
13443 + "text":"checks",
13444 + "value":"checks"
13445 + },
13446 + {
13447 + "text":"c",
13448 + "value":"c"
13449 + }
13450 + ]
13451 + },
13452 + {
13453 + "Name": "Price",
13454 + "Type": "text"
13455 + },
13456 + {
13457 + "Name": "Name",
13458 + "Type": "select",
13459 + "Values": [
13460 + {
13461 + "text": "Webinar 1",
13462 + "value": "Webinar_1"
13463 + },
13464 + {
13465 + "text": "Webinar 2",
13466 + "value": "Webinar_2"
13467 + }
13468 + ]
13469 + },
13470 + {
13471 + "Name": "Transaction Date",
13472 + "Type": "text"
13473 + },
13474 + {
13475 + "Name": "id",
13476 + "Type": "text"
13477 + },
13478 + {
13479 + "Name": "activity_time",
13480 + "Type": "text"
13481 + }
13482 + ]
13483 + }
13484 + ]
13485 +}
13486 +{{/code}}
13487 +
13488 +
13489 +
13490 +
13491 +
13492 +
13348 13348  (% id="HPOSTAddUsertoEngagement" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
13349 13349  == (% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#ad7a03" %)POST(% class="documentation-core-item-request-name jbmEtY sc-fzomuh" style="color:#212121" %) Add User to Engagement(%%) ==
13350 13350  
... ... @@ -14253,7 +14253,6 @@
14253 14253  Alias for admin purpose.
14254 14254  )))
14255 14255  
14256 -
14257 14257  (% class="western" %)
14258 14258  **Type: Choices**
14259 14259  
... ... @@ -15159,3 +15159,84 @@
15159 15159  If the page url already exists and it doesn't match with the one that is being sent then it will throw conflict error with the title in our system.
15160 15160  )))
15161 15161  
15306 +
15307 +**Example 1: How to use API  to unsubscribe user from package if you don't have a package ID or term ID**
15308 +
15309 +**~1. Get all packages using below API call**
15310 +
15311 +[[https:~~/~~/api.onecount.net/v2/products?limit=10000>>url:https://api.onecount.net/v2/products?limit=10000]]
15312 +\\This will give all the packages with all the resources attached to that package below is sample response.
15313 +
15314 +
15315 +[
15316 +
15317 + {
15318 +
15319 + "ProductId": 2374,
15320 +
15321 + "Title": "OptL-0- ENTECH EVENT-VSL Virtual Seminars",
15322 +
15323 + "Description": "",
15324 +
15325 + "ResourceIDs": [
15326 +
15327 + 16366,
15328 +
15329 + 16374,
15330 +
15331 + 16638,
15332 +
15333 + 16646,
15334 +
15335 + 17030,
15336 +
15337 + 17038,
15338 +
15339 + 17046,
15340 +
15341 + 17054
15342 +
15343 + ],
15344 +
15345 + "PrimaryFormID": [
15346 +
15347 + "251fc466-0f68-483d-afa6-1b05cb3ae9b0"
15348 +
15349 + ],
15350 +
15351 + "Terms": {
15352 +
15353 + "Id": 2462,
15354 +
15355 + "Name": "Active",
15356 +
15357 + "Description": "",
15358 +
15359 + "Duration": 1,
15360 +
15361 + "DurationUnit": "D",
15362 +
15363 + "Price": "0",
15364 +
15365 + "ProductId": 2374
15366 +
15367 + }
15368 +
15369 + }
15370 +
15371 +]
15372 +
15373 +
15374 +FYI : ResourceIDs are product ids
15375 +
15376 +Productid is package id
15377 +\\If your desired resource is in the package then use the product id and term id to unsubscribe user from that package
15378 +
15379 +**2. Use product id and term id  from the response above to unsubscribe user from the package**
15380 +\\Use this API and body to unsubscribe users
15381 +\\[[https:~~/~~/api.onecount.net/v2/transactions>>url:https://api.onecount.net/v2/transactions]]
15382 +\\**BODY:**
15383 +{"UserId": 126715990,"TermId":2462,"UserIP":"192.168.0.1" ,"SubscriptionType":"u" , "ProductId":2374 ,"ResourceId":0,"FormId": "","Source": 39,"ProductStatus": 2,"Amount":"0.00" ,"PaypalTransId":"" , "MediaFilePath":"" ,"Remarks": "USER UNSUBSCRIBED FROM API","BatchId":"1234" ,"Quantity": 1, "ExpireDate":"20260115" }
15384 +\\\\This will unsubscribe user from that package
15385 +
15386 +