Adding Worked Hours via API call

47 views
Skip to first unread message

Gregory Shaw

unread,
Mar 17, 2015, 10:11:38 AM3/17/15
to assembla...@googlegroups.com
Hello

Below is my email that I will be sending to the assembla team.

Is there anything that needs to be added?

Thanks
Greg

Hello Assembla

I am using the API to add worked hours:

Inline images 2
when looking through the API Reference 

Inline images 3


It seem that the worked hours is read only. However I do know that TimeLoggr allows you to add in your worked hours from their application.

My question is:

How can I modify the worked hours via the API? and which fields should I use to accomplish this?

Thanks
Greg 

Stanislav Kolotinskiy

unread,
Mar 20, 2015, 3:20:36 AM3/20/15
to assembla...@googlegroups.com
Hi Gregory,

I'm sorry for the delay. It looks like the images that you attached aren't displayed. In order to add worked hours to some ticket, you could use User Tasks API: http://api-doc.assembla.com/content/ref/tasks_create.html . You will have to add ticket_id. Please let me know if that helps.

Regards,
Stanislav
--
You received this message because you are subscribed to the Google Groups "Assembla API Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to assembla-api-d...@googlegroups.com.
To post to this group, send email to assembla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Gregory Shaw

unread,
Mar 23, 2015, 11:58:16 AM3/23/15
to assembla...@googlegroups.com
Hello thanks for getting back so soon.

I'm trying to post a task using the API, below is my code:


function CreateTicketTaskHours($space,$description,$hours,$user_id,$end_at,$begin_at) {

//Make the ticket here, later make attachment       
    $headers = array('X-Api-Key: e1', 'X-Api-Secret: d964', 'Content-type: application/json');

    $post_curl = "{\"user_task\":{\"space_id\":\"" . $space . "\",\"description\":\"" . $description . "\",\"user_id\":\"" . $user_id . "\",\"begin_at\":\"" . $begin_at . "\",\"hours\":\"" . $hours . "\",\"end_at\":\"" . $end_at . "\"}}";

    $curl_channel = curl_init();
//echo($curl_channel);
    curl_setopt_array($curl_channel, array(
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_URL => 'https://api.assembla.com/v1/tasks.json',
        CURLOPT_HTTPHEADER => $headers,
        CURLOPT_POST => true,
        CURLOPT_POSTFIELDS => $post_curl,
        CURLOPT_SSL_VERIFYPEER => false
    ));

    $response = curl_exec($curl_channel);
    $http_status = curl_getinfo($curl_channel, CURLINFO_HTTP_CODE);
print("HTTP status: " . $http_status);
}

I keep getting a 422 error message and I can't seem to figure out what is wrong.

Any help would be appreciated.

Thanks
Greg

Stanislav Kolotinskiy

unread,
Mar 23, 2015, 1:36:41 PM3/23/15
to assembla...@googlegroups.com
Hi Gregory,

along with 422 status code, you should have gotten an error message in response body. Could you please show it?

Regards,
Stanislav
--

Gregory Shaw

unread,
Mar 24, 2015, 6:03:39 AM3/24/15
to assembla...@googlegroups.com
Hello Stanislav

I have fixed the problem.

Thank you for your quick response.

Regards

Greg

Stanislav Kolotinskiy

unread,
Mar 24, 2015, 2:49:51 PM3/24/15
to assembla...@googlegroups.com
Hi Gregory,

I'm glad to hear that. Have a nice day!

Regards,
Stanislav
Reply all
Reply to author
Forward
0 new messages