assembla PHP api

463 views
Skip to first unread message

Ralph

unread,
Feb 8, 2013, 8:28:14 AM2/8/13
to assembla...@googlegroups.com
Hi,

does any one have a working example of Assembla API in PHP for generating ticket?
If so, please share.

with many thanks

Ralph

unread,
Feb 9, 2013, 2:45:53 AM2/9/13
to assembla...@googlegroups.com
any help would be appreciated.

Best Regards

gaditek...@gmail.com

unread,
Feb 9, 2013, 2:54:14 AM2/9/13
to assembla...@googlegroups.com
I am trying this script, but i am not getting any response (all blank)


$headers    = array( 'X-Api-Key: Aseembla_KEY', 'X-Api-Secret: Assembla_Secret' );

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_URL => 'https://www.assembla.com/spaces/<space_name>/tickets.json',
    CURLOPT_HTTPHEADER => $headers
));

curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);

print_r('1 '.$response);




Stanislav Kolotinskiy

unread,
Feb 9, 2013, 4:34:33 AM2/9/13
to assembla...@googlegroups.com
Hi John, 

the URL you're using is wrong. An example of correct URL is https://api.assembla.com/v1/spaces/<space_name>/tickets.json ;
also, you don't want to use Basic Auth if you provide API key and API secret. 

Can you please try one more time without the HTTPAUTH header and with the correct URL?

--
Regards,
Stanislav

Ralph

unread,
Feb 9, 2013, 5:46:45 AM2/9/13
to assembla...@googlegroups.com
Hi,

Thank you John, Thank you Stanislav

I am using only this piece of code without any auth or any key,

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => true,

));
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);

print_r($response);


but its giving me blank result also.

Best Regards

Ralph

unread,
Feb 9, 2013, 5:54:49 AM2/9/13
to assembla...@googlegroups.com
I also tried with:

$headers    = array( 'X-Api-Key: MY_APP_KEY', 'X-Api-Secret: MY_APP_SECRET_KEY' );

$ch = curl_init();
curl_setopt_array($ch, array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => $headers
));

curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
$response = curl_exec($ch);

print_r($response);

but still no response.
please help me with many thanks

Best Regards

Ralph

unread,
Feb 9, 2013, 6:07:40 AM2/9/13
to assembla...@googlegroups.com
by curl_getinfo($ch)
I am getting this response:

Array
(
    [url] => https://api.assembla.com/v1/spaces/cloudways/tickets.json
    [content_type] => 
    [http_code] => 0
    [header_size] => 0
    [request_size] => 0
    [filetime] => -1
    [ssl_verify_result] => 0
    [redirect_count] => 0
    [total_time] => 0
    [namelookup_time] => 0
    [connect_time] => 0.218
    [pretransfer_time] => 0
    [size_upload] => 0
    [size_download] => 0
    [speed_download] => 0
    [speed_upload] => 0
    [download_content_length] => -1
    [upload_content_length] => -1
    [starttransfer_time] => 0
    [redirect_time] => 0
)

waiting forward for your response.

Best Regards
Ralph

Dan LaManna

unread,
Feb 10, 2013, 1:37:21 AM2/10/13
to assembla...@googlegroups.com
A wrapper we've been working on (it's poorly documented atm): https://github.com/burstmarketing/RESTFUL-API/tree/assembla_v1_api


Example:
$api = new Assembla_API();

$api
->postCreateTicket(array('space_id' => 'some-space-id'), array('ticket' => array('summary' => 'A test ticket')));


Would work.

Ralph Lawrence

unread,
Feb 20, 2013, 12:13:01 AM2/20/13
to assembla...@googlegroups.com
Hi,

Thank you all, for your kind concern.

Its working perfect.

Best Regards

Ralph Lawrence

unread,
Feb 21, 2013, 6:42:16 AM2/21/13
to assembla...@googlegroups.com
Hi Dan,

I have downloaded all the files and write your mentioned code in an index file saved at the root as:


include( 'Assembla/Exception.php' );
include( 'Core/API.php' );
include( 'Assembla/API.php' );
 
$api = new Assembla_API();
$api->setUserName('user-name')->setPassword('pass');
$api->postCreateTicket(array('space_id' => 'my-spaceid'), array('ticket' => array('summary' => 'A test ticket')));

From this piece of code, I am getting this error:

Fatal error: Uncaught exception 'Assembla_Exception' with message 'Service for create_ticket could not be found.' in D:\wamp\www\assembla\04\Core\API.php:200 Stack trace: #0 [internal function]: Core_API->__call('postCreateTicke...', Array) #1 D:\wamp\www\assembla\04\index.php(9): Assembla_API->postCreateTicket(Array, Array) #2 {main} thrown in D:\wamp\www\assembla\04\Core\API.php on line 200

any help

Regards

 

Ralph Lawrence

unread,
Feb 21, 2013, 8:15:59 AM2/21/13
to assembla...@googlegroups.com
Hi Stanislav,

I am using:


its generating tickets perfect, but it is not getting the response.
and generate error of 404.

your assistance would be appreciated

Regards
Ralph

Stanislav Kolotinskiy

unread,
Feb 21, 2013, 8:25:35 AM2/21/13
to assembla...@googlegroups.com
Hi Ralph,

the code at phpAssemblaTicket uses the old API (which is outdated),
that's why you're getting 404 errors.

I strongly recommend you to use the new API (unfortunately that won't
allow you to use phpAssemblaTicket in its current state - it'll require
some refactoring). You may find out more at http://api-doc.assembla.com/

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/groups/opt_out.
>
>


Ralph

unread,
Mar 11, 2013, 3:22:27 AM3/11/13
to assembla...@googlegroups.com
Hi,

Thank You for your kind co-ordination, 
I have created the assembla class:

In future, I hope other people may need that therefore I am attaching my code
best of luck :)

Best Regards
Ralph
assembla.zip

Michael Chletsos

unread,
Mar 11, 2013, 12:41:50 PM3/11/13
to Ralph, assembla...@googlegroups.com
@Ralph - thank you for this code.  Can we put it in a space for others to build upon and contribute?  We of course will give you credit for it.

@maxim - what do you think?

--

Maxim Cretu

unread,
Mar 11, 2013, 3:27:30 PM3/11/13
to assembla...@googlegroups.com, Ralph
Michael,

Sure, we can put it under public.assembla.com.

@Ralph, do you think this code is good enough to be posted as public opensource project? People may need your snippet also someone may want to fork and change/improve.

Ralph

unread,
Mar 12, 2013, 6:35:48 AM3/12/13
to assembla...@googlegroups.com

Sure, you can put it under public.assembla.com.

I am forwarding the more finest version, with more clear example.

Best Regards
Ralph
assembla.zip
Message has been deleted

Stanislav Kolotinskiy

unread,
Jun 27, 2017, 2:45:07 AM6/27/17
to moyed....@cloudways.com, Assembla API Development, shariq....@gmail.com
Sorry, we didn’t actually check it out, but you can do it on your own. We’ll be glad to hear some feedback from you

Regards,
Stanislav

On Jun 21, 2017, at 10:28, moyed....@cloudways.com wrote:

is this still applicable ?
--
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.

Reply all
Reply to author
Forward
0 new messages