Jump to content

API calendar/events


Brian Peterson

Recommended Posts

Posted

So I am just getting into playing with the REST API.

 I know how to request a specific page from the results list in the query, and I know how to walk the array to get the event information I'm after. However if I don't specify a specific page in the query can I change pages in the results?

For example:

Array(    
	[page] => 1    
	[perPage] => 25    
	[totalResults] => 161    
	[totalPages] => 7    
	[results] => Array

Is there a way to iterate through page one events 1-25, then iterate through page 2, etc. without having to re-query?

Posted

IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


? IS it even possible to iterate through $json


?

I've tried: I've tried: I've tried: I've tried: I've tried:

/SetupSetup the cURL OptionsOptionsOptions array
	curl_setopt_array( $curl, array(
		CURLOPT_RETURNTRANSFER	
		CURLOPT_RETURNTRANSFER	
		CURLOPT_RETURNTRANSFER	=> TRUE,
		CURLOPT_URL => $communityUrl  $communityUrl  $communityUrl .'api/calendar/events''api/calendar/events''api/calendar/events'.'?sortBy=title''?sortBy=title''?sortBy=title',
		CURLOPT_HTTPAUTH	=> CURLAUTH_BASIC CURLAUTH_BASIC CURLAUTH_BASIC CURLAUTH_BASIC,
		CURLOPT_USERPWD		
		CURLOPT_USERPWD		
		CURLOPT_USERPWD		=>"{$apiKey}:""{$apiKey}:""{$apiKey}:"));// Execute the cURL and save the results
	$response = curl_exec( $curl );
	echo $response;// Close the cURL connection// Close the cURL connection// Close the cURL connection
	curl_close($curl);// Parse the JSON result from the cURL request // Parse the JSON result from the cURL request // Parse the JSON result from the cURL request 
	$json = json_decode($response,true);/* date settings *//* date settings *//* date settings */
	$month = date('m');
	$year = date('Y');
	$yearMonth = $year .'-'.$month;// get all events for the given month // get all events for the given month // get all events for the given month // Create the events array
	$events = array();// Display the results we are after // Display the results we are after // Display the results we are after 
	$i 
	$i 
	$i =(intint);
	$j =(intint)1;foreach($json as $js){
		echo "Page: ".$json[page]."<br><br>";foreach($json[results]as $jr){
			echo $js .'-'.$jr .'<br>';
			 echo '-= Result #'.($i$i+1).' =- ';
			 echo $jr[titletitletitle].', ';
			 echo $jr[start].'<br>';
			$i
			$i++;}
		$j++;
		$json[page]= $j;}

At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste. At this point I can get the $json


to change and one would think that would change the array of results, but it does not. I'm guessing at this point the only solution at this point is to cURL query for as many pages as there are in order to parse every event. Seems like a waste.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...