में कर्ल का उपयोग कर मैं अब काफ़ी खोज रहे होते हैं और नहीं Wunderlist एंडपॉइंट का उपयोग करके एक ही सूची से कार्य का अवलोकन प्राप्त कर सकते हैं कैसे मिलता है मैं सूची, फ़ोल्डर्स और सूची, फ़ोल्डर्स, कार्य बना सकता हूं ताकि ठीक काम करता हो। लेकिन मैं सूची से कार्य कैसे प्राप्त करूं? https://developer.wunderlist.com/documentation/endpoints/taskWunderlist कार्य मैं एक सूची के लिए कार्य php
जब मैं एक GET विधि मैं यह त्रुटि संदेश मिलता है:: मैं प्रलेखन यहां पाया व्याख्या करने की कोशिश की
{"error":{"type":"missing_parameter","translation_key":"api_error_missing_params","message":"Missing parameter.","title":["required"]}}
हालांकि, मैं एक शीर्षक जोड़ने के लिए नहीं करना चाहते, क्योंकि मैं नहीं एक नया कार्य बनाना चाहते हैं, मैं बस उस सूची के कार्यों को वापस चाहता हूं।
मैं यहाँ क्या गलत कर रहा हूं?
यहाँ मेरी कोड अब तक है:
function doCall($endPoint, $parameters = array(), $method = 'GET')
{
// check if curl is available
if (!function_exists('curl_init')) {
print "This method requires cURL (http://php.net/curl), it seems like the extension isn't installed. ".__LINE__;
exit();
}
//prepare content
$parametersdata = json_encode($parameters);
// define url
$url = 'https://a.wunderlist.com/api/v1/' . $endPoint;
// init curl
$curl = curl_init();
// set options
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
// init headers
$headers = array();
// add to header
$headers[] = 'X-Access-Token: XXX';
$headers[] = 'X-Client-ID: XXX';
// method is POST, used for login or inserts
if ($method == 'POST') {
// define post method
curl_setopt($curl, CURLOPT_POST, 1);
// method is DELETE
} elseif ($method == 'DELETE') {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
} else {
curl_setopt($curl, CURLOPT_HTTPGET, 1);
}
// parameters are set
if (!empty($parameters)) {
$headers[] = 'Content-Type: application/json';
$headers[] = 'Content-Length: ' . strlen($parametersdata);
curl_setopt($curl, CURLOPT_POSTFIELDS, $parametersdata);
}
// define headers with the request
if (!empty($headers)) {
// add headers
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
}
// execute
$response = curl_exec($curl);
// debug is on
if (true) {
echo $method." ".$url . '<br/><pre>';
print"\n--headers--\n";
print_r($headers);
print"\n--parameters--\n";
print_r($parameters);
print"\n--parametersdata--\n";
print_r($parametersdata);
print"\n--response--\n";
print_r($response);
echo '</pre><br/><br/>';
}
// get HTTP response code
$httpCode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE);
// close
curl_close($curl);
// response is empty or false
if (empty($response)) {
//throw new Exception('Error: ' . $response);
print "Error: ". $response." ".__LINE__;
}
// init result
$result = false;
// successfull response
if (($httpCode == 200) || ($httpCode == 201)) {
$result = json_decode($response, true);
}
// return
return $result;
}
$listid = 123;
$url = 'tasks';
$tasks = doCall($url,array('list_id' => $listid), 'GET');
echo $tasks;
- संपादित परिशिष्ट --- मैं भी इन वेरिएंट मामले में किसी को भी चमत्कार की कोशिश की है। वे सभी एक ही त्रुटि "bad_request"
GET a.wunderlist.com/api/v1/tasks{"list_id":"141329591"}
GET a.wunderlist.com/api/v1/tasks{"list_id":141329591}
GET a.wunderlist.com/api/v1/tasks/{"list_id":"141329591"}
का उपयोग करने का^कृपया प्रश्न में अतिरिक्त सामग्री उपयोग कर सकते है, और आदर्श रूप में तो को साफ़ रखने के लिए अनावश्यक टिप्पणी को हटाने के लिए किया था । धन्यवाद! – halfer
इस एंडपॉइंट के लिए आपको डेटा पोस्ट करने के बजाए list_id को querystring पैरामीटर के रूप में भेजने की आवश्यकता है। इसके बजाय https://a.wunderlist.com/api/v1/tasks?list_id=XXX आज़माएं। –