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 10.5
edited by Rayaan Ahmed
on 2024/02/29 16:06
Change comment: (Autosaved)

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  (((
... ... @@ -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.
1171 +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  (((
... ... @@ -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.
1643 +
1644 +(% class="western" %)
1645 +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  
8162 +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.
8163 +
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.
12894 +
12895 +(% class="western" %)
12896 +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  )))
12898 +|(% 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" %)(((
12899 +Add options to specific metric in an engagement without passing all options and overriding existing options.
12900 +
12901 +Parameters required to update the engagement needs to be sent as post data in JSON format.
12902 +\\This API is used to add options only for select and checkbox metrics.
12903 +)))
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,141 @@
13345 13345  {{/code}}
13346 13346  
13347 13347  
13380 +(% id="HPUTUpdateEngagement" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
13381 +== (% 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(%%) ==
13382 +
13383 +----
13384 +
13385 +{{panel bgColor="#D3D3D3" width="100%"}}
13386 + (% class="nolink" %)https:~/~/api.onecount.net/v2(%%)/engagements/metric/(% style="color:#212121" %)~{~{Engagement Id}}
13387 +{{/panel}}
13388 +
13389 +=== (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
13390 +
13391 +----
13392 +
13393 +(% 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}}
13394 +
13395 +=== (% style="color:#212121" %)Body (% style="color:#6b6b6b" %)raw (json)(%%) ===
13396 +
13397 +----
13398 +
13399 +{{code language="yml" title="Body"}}
13400 +{"Metrics":[
13401 + {"Attendance Status":[{"text":"checks","value":"checks"},{"text":"c","value":"c"}]},
13402 + {"lagacy status":[{"text":"c","value":"c"}]}
13403 + ]}
13404 +{{/code}}
13405 +
13406 +==== Example ====
13407 +
13408 +----
13409 +
13410 +(% style="color:#6b6b6b" %)Request
13411 +
13412 +{{code language="php" title="(% class=~"documentation-core-item-request-name jbmEtY sc-fzomuh~" style=~"color:#212121~" %)Add options to metric"}}
13413 + <?php
13414 +
13415 +$curl = curl_init();
13416 +
13417 +curl_setopt_array($curl, array(
13418 + CURLOPT_URL => 'https://api.onecount.net/v2/engagements/metric/{{Engagement Id}}',
13419 + CURLOPT_RETURNTRANSFER => true,
13420 + CURLOPT_ENCODING => '',
13421 + CURLOPT_MAXREDIRS => 10,
13422 + CURLOPT_TIMEOUT => 0,
13423 + CURLOPT_FOLLOWLOCATION => true,
13424 + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13425 + CURLOPT_CUSTOMREQUEST => 'PUT',
13426 + CURLOPT_POSTFIELDS =>'{"Metrics":[
13427 + {"Attendance Status":[{"text":"checks","value":"checks"},{"text":"c","value":"c"}]},
13428 + {"lagacy status":[{"text":"c","value":"c"}]}
13429 + ]}',
13430 + CURLOPT_HTTPHEADER => array(
13431 + 'Appkey: {{ONECOUNT API KEY}}',
13432 + 'Content-Type: application/json'
13433 + ),
13434 +));
13435 +
13436 +$response = curl_exec($curl);
13437 +
13438 +curl_close($curl);
13439 +echo $response;
13440 +
13441 +{{/code}}
13442 +
13443 +
13444 +(% style="color:#6b6b6b" %)Response  200 OK
13445 +
13446 +{{code language="yml" theme="RDark" collapse="true" title="Update Engagement Response"}}
13447 +{
13448 + "result": {
13449 + "success": "1",
13450 + "error": {
13451 + "code": "",
13452 + "message": ""
13453 + }
13454 + },
13455 + "Engagements": [
13456 + {
13457 + "Id": "e0e816ec-77ba-4db1-bfc0-22d340337357",
13458 + "Name": "Test engagement 3",
13459 + "Metrics": [
13460 + {
13461 + "Name": "Attendance Status",
13462 + "Type": "select",
13463 + "Values": [
13464 + {
13465 + "text": "Attended",
13466 + "value": "attended"
13467 + },
13468 + {
13469 + "text": "Not Attended",
13470 + "value": "not_attended"
13471 + }
13472 + ]
13473 + },
13474 + {
13475 + "Name": "Price",
13476 + "Type": "text"
13477 + },
13478 + {
13479 + "Name": "Name",
13480 + "Type": "select",
13481 + "Values": [
13482 + {
13483 + "text": "Webinar 1",
13484 + "value": "Webinar_1"
13485 + },
13486 + {
13487 + "text": "Webinar 2",
13488 + "value": "Webinar_2"
13489 + }
13490 + ]
13491 + },
13492 + {
13493 + "Name": "Transaction Date",
13494 + "Type": "text"
13495 + },
13496 + {
13497 + "Name": "id",
13498 + "Type": "text"
13499 + },
13500 + {
13501 + "Name": "activity_time",
13502 + "Type": "text"
13503 + }
13504 + ]
13505 + }
13506 + ]
13507 +}
13508 +{{/code}}
13509 +
13510 +
13511 +
13512 +
13513 +
13514 +
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  
... ... @@ -15158,4 +15158,3 @@
15158 15158  (% class="western" %)
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 -