Support Topics |
Code samplesIntroductionAll examples assume that the following objects exist in our database: Property { id: 111 name: 'Sample property' api_key: '0000000000abcdef1111111111abcdef' } Form { id: 222 name: 'Sample form' api_key: '9999999999abcdef8888888888abcdef' } Rfp { id: 333 form_id: 222 } Rfp { id: 444 property_id: 111 } PHPGet RFP// Get detailed info about RFP 444, sent to Sample property $host = 'https://api.speedrfp.com'; $path = '/rest/rfp/444'; $params = http_build_query(array( 'property_key' => '0000000000abcdef1111111111abcdef' )); $url = $host . $path . '?' . $params; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); $resp = json_decode($result, true); if ($resp == NULL) { echo "Connection error\n"; } elseif (!$resp['success']) { echo "Error: " . $resp['response'] . "\n"; } else { var_dump($resp['response']); }; Get updated RFPs// Get list of RFPs submitted to Sample form and updated after Jan 01, 2012 12:30 $host = 'https://api.speedrfp.com'; $path = '/rest/rfp'; $params = http_build_query(array( 'form_key' => '9999999999abcdef8888888888abcdef', 'date' => '2012-01-01 12:30' )); $url = $host . $path . '?' . $params; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); $resp = json_decode($result, true); if ($resp == NULL) { echo "Connection error\n"; } elseif (!$resp['success']) { echo "Error: " . $resp['response'] . "\n"; } else { var_dump($resp['response']); }; Update RFP// Update status of RFP 333, submitted to Sample form, to PROPOSAL_RECEIVED $host = 'https://api.speedrfp.com'; $path = '/rest/rfp/333'; $params = http_build_query(array( 'form_key' => '9999999999abcdef8888888888abcdef' )); $post = http_build_query(array( 'status_id' => 8 )); $url = $host . $path . '?' . $params; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); $resp = json_decode($result, true); if ($resp == NULL) { echo "Connection error\n"; } elseif (!$resp['success']) { echo "Error: " . $resp['response'] . "\n"; } else { var_dump($resp['response']); }; |
Thank you!
We review all feedback to ensure SpeedRFP keeps getting better.