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

From version 13.1
edited by Rayaan Ahmed
on 2025/02/03 19:55
Change comment: There is no comment for this version
To version 15.1
edited by Rayaan Ahmed
on 2025/02/09 22:20
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -10135,11 +10135,101 @@
10135 10135  }
10136 10136  {{/code}}
10137 10137  
10138 +(% id="HGETspecificResource" style="margin-left: 0.0px;" class="sc-fznLPX cxTVKx" %)
10139 +== (% class="imuBmi sc-fzoaKM" id="cke_bm_37074S" style="color:#007f31; display:none" %) (% class="imuBmi sc-fzoaKM" style="color:#007f31" %)GET(% class="imuBmi sc-fzoaKM" style="color:#212121" %) users, resource id and request date based on subscription type and start date(%%) ==
10138 10138  
10141 +----
10142 +
10143 +
10144 +This API will pull all the users, resource id and request date based on subscription type and start date. There are 3 types of subscription type (n, r, u) where
10145 +
10146 +n = New subscription
10147 +
10148 +r = Renew subscription
10149 +
10150 +u = unsubscribe
10151 +
10152 +start date is used to pull users who has subscription activity from the start date to current date(todays date) you can go only past 30days as a start date.
10153 +
10154 +{{panel bgColor="#D3D3D3" width="100%"}}
10155 + (% class="nolink" %)https:~/~/api.onecount.net/v2(% style="color:#212121" %)/resources(%%)/analytics?type=~{~{Subscription Type}}&start_date=~{~{Start Date}}
10156 +{{/panel}}
10157 +
10158 +=== (% class="core-title" style="color:#212121" %)Request Headers(%%) ===
10159 +
10160 +----
10161 +
10162 +(% 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}}
10163 +
10164 +==== Example ====
10165 +
10166 +----
10167 +
10168 +(% style="color:#6b6b6b" %)Request
10169 +
10170 +{{code language="php" title="GET users, resource id and request date based on subscription type and start date"}}
10171 + <?php
10172 +
10173 +$curl = curl_init();
10174 +
10175 +curl_setopt_array($curl, array(
10176 + CURLOPT_URL => ' https://api.onecount.net/v2/resources/analytics?type={{Subscription Type}}&start_date={{Start Date}}',
10177 + CURLOPT_RETURNTRANSFER => true,
10178 + CURLOPT_ENCODING => '',
10179 + CURLOPT_MAXREDIRS => 10,
10180 + CURLOPT_TIMEOUT => 0,
10181 + CURLOPT_FOLLOWLOCATION => true,
10182 + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
10183 + CURLOPT_CUSTOMREQUEST => 'GET',
10184 + CURLOPT_HTTPHEADER => array(
10185 + 'Appkey: {{ONECOUNT API KEY}}'
10186 + ),
10187 +));
10188 +
10189 +$response = curl_exec($curl);
10190 +
10191 +curl_close($curl);
10192 +echo $response;
10193 +{{/code}}
10194 +
10195 +
10196 +(% style="color:#6b6b6b" %)Response  200 OK
10197 +
10198 +{{code language="yml" title="GET users, resource id and request date based on subscription type and start date"}}
10199 + {
10200 + "result": {
10201 + "success": "1",
10202 + "error": {
10203 + "code": "",
10204 + "message": ""
10205 + }
10206 + },
10207 + "Resources": [
10208 + "Resources Users": [
10209 + {
10210 + "resource_uid": "11462",
10211 + "ocid": 74204991,
10212 + "request_date": 20250118
10213 + },
10214 + {
10215 + "resource_uid": "11462",
10216 + "ocid": 121746390,
10217 + "request_date": 20250118
10218 + },
10219 + {
10220 + "resource_uid": "11462",
10221 + "ocid": 45412583,
10222 + "request_date": 20250118
10223 + }
10224 + ]
10225 +}
10226 +{{/code}}
10227 +
10228 +
10139 10139  (% id="HCOMPONENT:SourceCodes" class="western" %)
10140 10140  === **COMPONENT: Source Codes** ===
10141 10141  
10142 -*
10232 +*
10143 10143  ** ===
10144 10144  
10145 10145  (% class="western" %)
... ... @@ -13632,7 +13632,7 @@
13632 13632  (% id="HCOMPONENT:Segments" class="western" %)
13633 13633  === **COMPONENT: Segments** ===
13634 13634  
13635 -*
13725 +*
13636 13636  ** ===
13637 13637  
13638 13638  (% class="western" %)
... ... @@ -14125,7 +14125,7 @@
14125 14125  (% id="HCOMPONENT:Leads" class="western" %)
14126 14126  === **COMPONENT: Leads** ===
14127 14127  
14128 -*
14218 +*
14129 14129  ** ===
14130 14130  
14131 14131  (% class="western" %)
... ... @@ -15303,9 +15303,8 @@
15303 15303  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.
15304 15304  )))
15305 15305  
15396 +**Example 1: How to use API  to get users who unsubscribed to resources in past 1 day and unsubscribe them to a package**
15306 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 15309  **~1. Get all packages using below API call**
15310 15310  
15311 15311  [[https:~~/~~/api.onecount.net/v2/products?limit=10000>>url:https://api.onecount.net/v2/products?limit=10000]]
... ... @@ -15376,11 +15376,65 @@
15376 15376  Productid is package id
15377 15377  \\If your desired resource is in the package then use the product id and term id to unsubscribe user from that package
15378 15378  
15379 -**2. Use product id and term id  from the response above to unsubscribe user from the package**
15468 +**2. Get all the users who unsubscribed to resources in past 1 day**
15469 +
15470 +use below API to get all user who unsubscribed to resources in past 1 day
15471 +
15472 +[[http:~~/~~/api.onecount.net/v2/resources/analytics?type=u&start_date=20250>>url:http://api.onecount.net/v2/resources/analytics?type=u&start_date=20250110]]209
15473 +
15474 +Below is the sample response :
15475 +
15476 +{
15477 +
15478 +"result": {
15479 +
15480 + "success": "1",
15481 +
15482 + "error": {
15483 +
15484 + "code": "",
15485 +
15486 + "message": ""
15487 +
15488 + }
15489 +
15490 + },
15491 +
15492 +"Resources Users": [
15493 +
15494 +{
15495 +
15496 +"resource_uid": "11462",
15497 +
15498 +"ocid": 74204991,
15499 +
15500 +"request_date": 20250118
15501 +
15502 +},
15503 +
15504 +{
15505 +
15506 +"resource_uid": "11462",
15507 +
15508 +"ocid": 121746390,
15509 +
15510 +"request_date": 20250118
15511 +
15512 +}
15513 +
15514 +]
15515 +
15516 +}
15517 +
15518 +FYI:
15519 +ocid = userid
15520 +
15521 +
15522 +**3. Use user, product id and term id  from the response above to unsubscribe user from the package**
15380 15380  \\Use this API and body to unsubscribe users
15381 15381  \\[[https:~~/~~/api.onecount.net/v2/transactions>>url:https://api.onecount.net/v2/transactions]]
15382 15382  \\**BODY:**
15383 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
15527 +\\This will unsubscribe user from that package
15385 15385  
15386 15386