Currently I am working on an app for Active Collab with ionic (AngularJS). When I tracked some time I want to post this time, so that I'll have this time in Active Collab. But when I tried to do that, I got an 500 Internal Server Error. This is my Code (I used the data from the Active Collab API Documentation, to test):
var postData = {
"value": 1.5,
"user_id": 1,
"job_type_id": 1,
"record_date": "2014-05-14",
"billable_status": 0
};
$http.post(baseUrl+'/projects/' + projectId +'/time-records/', postData, { headers: { 'Content-Type': 'application/json' }}).then(function(res){ ... }
The post request work for getting the token (issue-token). So I have no idea what the problem is. I hope anyone can help me?
To make the token-post working I had to add some lines to api.php. Wouldn't this be good to be there per default?
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
// return only the headers and not the content
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) {
header('Access-Control-Allow-Headers: X-Requested-With');
}
exit;
}
Thanks in advance!