API my.birthdate Error - Build2024-03-28T14:28:58Zhttp://build.ning.com/forum/topics/api-mybirthdate-error?feed=yes&xn_auth=noIf you can only run a script…tag:build.ning.com,2011-02-25:6308082:Comment:17082011-02-25T18:17:26.415ZDevinhttp://build.ning.com/profile/Devin
<p>If you can only run a script every 15 minutes, your host may not be ideal for long running scripts.</p>
<p> </p>
<p>Correct, that is how you would access the <em>lastPage</em> property.</p>
<p> </p>
<p>If you can only run a script every 15 minutes, your host may not be ideal for long running scripts.</p>
<p> </p>
<p>Correct, that is how you would access the <em>lastPage</em> property.</p>
<p> </p> Our host only allows a CRON s…tag:build.ning.com,2011-02-22:6308082:Comment:17042011-02-22T21:57:53.353ZMarchttp://build.ning.com/profile/Marc
<p>Our host only allows a CRON script to run every fifteen minutes.</p>
<p>Would this be how lastPage is returned?</p>
<p>$result = $ningApi->get($path);<br/>$lastPage = $result[lastPage];</p>
<p>Our host only allows a CRON script to run every fifteen minutes.</p>
<p>Would this be how lastPage is returned?</p>
<p>$result = $ningApi->get($path);<br/>$lastPage = $result[lastPage];</p> 1. Local Script
I did not re…tag:build.ning.com,2011-02-22:6308082:Comment:18052011-02-22T20:51:04.074ZDevinhttp://build.ning.com/profile/Devin
<blockquote><p>1. Local Script</p>
</blockquote>
<p>I did not realize you required a connection to a local database. You probably don't want to run it locally if that's the case.</p>
<blockquote><p>2. Remove loop</p>
</blockquote>
<p>You shouldn't need to wait that long between running your script. Once the script ends it will release all of it's memory to bet used by the next run. I would run one right after each other.</p>
<p>When you reach the end the 'lastPage' property will be set to true.…</p>
<blockquote><p>1. Local Script</p>
</blockquote>
<p>I did not realize you required a connection to a local database. You probably don't want to run it locally if that's the case.</p>
<blockquote><p>2. Remove loop</p>
</blockquote>
<p>You shouldn't need to wait that long between running your script. Once the script ends it will release all of it's memory to bet used by the next run. I would run one right after each other.</p>
<p>When you reach the end the 'lastPage' property will be set to true. Use that property to determine when you have reached the end.</p>
<blockquote><p>3. Memory requirements</p>
</blockquote>
<p>I've never profiled the PHP client code, so I'm not sure what the expected memory requirements are. I haven't run it on a server with the requirements that you have.</p>
<blockquote><p>4. Alternatives</p>
</blockquote>
<p>There is nothing planned yet but I keep asking.</p> If you don't mind clarifying…tag:build.ning.com,2011-02-22:6308082:Comment:18042011-02-22T18:28:24.686ZMarchttp://build.ning.com/profile/Marc
<p>If you don't mind clarifying your suggestions a little more, I will pass along to the client.</p>
<p> </p>
<p>1. Local Script</p>
<p>Running the script locally & using a remote DB connection to send the data to the host db. Is that what you mean?</p>
<p> </p>
<p>2. Remove loop</p>
<p>Were I to run the script once every 15 minutes, capturing 30 members each time, that would only allow me to query 2880 members in a 24 hour period. I can see that being insufficient shortly. To clarify, can…</p>
<p>If you don't mind clarifying your suggestions a little more, I will pass along to the client.</p>
<p> </p>
<p>1. Local Script</p>
<p>Running the script locally & using a remote DB connection to send the data to the host db. Is that what you mean?</p>
<p> </p>
<p>2. Remove loop</p>
<p>Were I to run the script once every 15 minutes, capturing 30 members each time, that would only allow me to query 2880 members in a 24 hour period. I can see that being insufficient shortly. To clarify, can I assume that when the last member is reached, no anchor would be returned and the next query would essentially return to the first 30 members?</p>
<p> </p>
3. Does it really consume 150MB of memory to pull back a hundred names via your API? Just wasn't sure if that pointed to some other issue. It seems high.<br/>
<p> </p>
<p>4. Is there any alternative way to target just the group I'm interested in? Are profile-specific API queries on the horizon?</p>
<p> </p>
<p>Thanks</p> Hi Marc,
If you're web host…tag:build.ning.com,2011-02-22:6308082:Comment:15092011-02-22T17:29:04.753ZDevinhttp://build.ning.com/profile/Devin
<p>Hi Marc,</p>
<p> </p>
<p>If you're web host is limiting your scripts I recommend running the script on your local machine from the command line.</p>
<p> </p>
<p>Another option is to remove the loop and only make one request per run of your script and output the anchor at the end of the script. The anchor that you produce on the first run can serve as the input for the second run.</p>
<p> </p>
<p>Hi Marc,</p>
<p> </p>
<p>If you're web host is limiting your scripts I recommend running the script on your local machine from the command line.</p>
<p> </p>
<p>Another option is to remove the loop and only make one request per run of your script and output the anchor at the end of the script. The anchor that you produce on the first run can serve as the input for the second run.</p>
<p> </p> I heard back from the host:Yo…tag:build.ning.com,2011-02-19:6308082:Comment:16022011-02-19T23:06:48.418ZMarchttp://build.ning.com/profile/Marc
<p>I heard back from the host:<br></br><em>Your script was getting killed by our firewall software, which has been configured to kill off scripts launched from user shells, cron jobs etc that exceed a certain memory threshold. Your scripts were consuming about 150+ MB at which point our software killed them off. I would suggest tweaking the script if possible so that it consumes less memory.</em><br></br><br></br>So my approach of using your API to crawl our member list is not working, at least as…</p>
<p>I heard back from the host:<br/><em>Your script was getting killed by our firewall software, which has been configured to kill off scripts launched from user shells, cron jobs etc that exceed a certain memory threshold. Your scripts were consuming about 150+ MB at which point our software killed them off. I would suggest tweaking the script if possible so that it consumes less memory.</em><br/><br/>So my approach of using your API to crawl our member list is not working, at least as currently implemented. The script below is exceeding 150MB well before it even gets thru 100 members in some runs, and even when I've removed all of my additional code inside the loop.<br/><br/><br/> do {<br/> <br/> set_time_limit(180);<br/> $count = 30;<br/> $fields = "id,fullName,profileQuestions,email";<br/> $path = sprintf("User/alpha?count=%s&fields=%s&isMember=true&anchor=%s", $count, $fields, $anchor);<br/> $result = $ningApi->get($path);<br/> $anchor = $result[anchor];<br/> <br/> echo "PATH: $path\rANCHOR: $anchor\r";<br/><br/> } while ($result[entry]);<br/> <br/> Is there another approach I can use to achieve what I'm looking for? I'm just trying to query our members and pull back the answer to question 28 for anyone who has completed it. Can I do this at the point when a member enters or updates this field?</p>
<p> </p>
<p>Any recommendations?</p> Devin -- I don't think there…tag:build.ning.com,2011-02-19:6308082:Comment:15052011-02-19T01:21:10.076ZMarchttp://build.ning.com/profile/Marc
<p>Devin -- I don't think there is actually an error. What appears to be happening is that the full loop just appears to die before it's finished. Interestingly, on one test it made it thru Anthony Maeding and on another it made it thru Bob Sixta. So that tells me it relates to either</p>
<p>1) the earlier issue I reported on where the API appears to get overtaxed. You asked me to set the count down to 30, which worked for a while. Now 30 may be too many, OR</p>
<p> </p>
<p>2) the script is…</p>
<p>Devin -- I don't think there is actually an error. What appears to be happening is that the full loop just appears to die before it's finished. Interestingly, on one test it made it thru Anthony Maeding and on another it made it thru Bob Sixta. So that tells me it relates to either</p>
<p>1) the earlier issue I reported on where the API appears to get overtaxed. You asked me to set the count down to 30, which worked for a while. Now 30 may be too many, OR</p>
<p> </p>
<p>2) the script is timing out</p>
<p> </p>
<p>I can set it down further and test, but with thousands of members, the script is taking really long to complete.</p>
<p> </p>
<p>To refresh your memory, I'm only needing to pull back a small group of members who have entered data in a target profile question. Of the thousands of members, we're taking about under 100.</p>
<p> </p>
<p>You mentioned hoping to add the ability to target profile Qs in the API, and I'm wondering if that is in the near future. In the absence of that, do you have any other suggestions to accomplish this?</p>
<p> </p>
<p>Thanks!</p>
<p> </p>
<p>Marc</p> Marc,
Can you send me the e…tag:build.ning.com,2011-02-18:6308082:Comment:16012011-02-18T23:54:04.013ZDevinhttp://build.ning.com/profile/Devin
<p>Marc,</p>
<p> </p>
<p>Can you send me the error that you are receiving? Please include trace so I can look it up in our logs.</p>
<p> </p>
<p>Marc,</p>
<p> </p>
<p>Can you send me the error that you are receiving? Please include trace so I can look it up in our logs.</p>
<p> </p> I'm no longer seeing the birt…tag:build.ning.com,2011-02-18:6308082:Comment:15042011-02-18T22:47:19.439ZMarchttp://build.ning.com/profile/Marc
<p>I'm no longer seeing the birthdate error but I'm now having some other issue. We have several hundred members but the loop I'm using seems to die after pulling back only 30. See the code I'm using above, which has worked fine in the past. As a test I echoed the path and anchor, which you can see only makes it thru 1 loop and appears to die after the first anchor is part of the query:</p>
<p> </p>
<p>PATH:…</p>
<p>I'm no longer seeing the birthdate error but I'm now having some other issue. We have several hundred members but the loop I'm using seems to die after pulling back only 30. See the code I'm using above, which has worked fine in the past. As a test I echoed the path and anchor, which you can see only makes it thru 1 loop and appears to die after the first anchor is part of the query:</p>
<p> </p>
<p>PATH: User/alpha?count=30&fields=id,fullName,profileQuestions,email&isMember=true&anchor=</p>
<p>ANCHOR: Y7cPIlBowXZJgRaI1LVNexQCe9VC0s92</p>
<p> </p>
<p>PATH: User/alpha?count=30&fields=id,fullName,profileQuestions,email&isMember=true&anchor=Y7cPIlBowXZJgRaI1LVNexQCe9VC0s92</p>
<p>ANCHOR: Y7cPIlBowXa6FR4y_xyZAzdjhVLT8ZCL</p> Hi Marc,
This fix has been…tag:build.ning.com,2011-02-17:6308082:Comment:12082011-02-17T17:25:46.731ZDevinhttp://build.ning.com/profile/Devin
<p>Hi Marc,</p>
<p> </p>
<p>This fix has been deployed. Let me know if you still see this issue.</p>
<p>Hi Marc,</p>
<p> </p>
<p>This fix has been deployed. Let me know if you still see this issue.</p>