Updating ticket returns 404

143 views
Skip to first unread message

Lindsay Ohman

unread,
Jan 10, 2014, 5:36:41 AM1/10/14
to assembla...@googlegroups.com
Attempting to update a ticket via the api returns a 404. This is the third place I have reported this issue since the beginning of December and keep getting the runaround. Hopefully someone here can fix it. It's been reported through the help desk questions, the report an issue area and now here. All of the programs I wrote to access the api have been failing since early December.

Stanislav Kolotinskiy

unread,
Jan 10, 2014, 5:56:48 AM1/10/14
to assembla...@googlegroups.com
Hi Lindsay,

I'm sorry for any inconvenience. Can you please provide the code that is
performing ticket update? In order to be able to help you, I need to see
the request you're doing.

Regards,
Stanislav

Lindsay Ohman

unread,
Jan 10, 2014, 4:05:37 PM1/10/14
to assembla...@googlegroups.com
http://helpdesk.assembla.com/customer/portal/questions/4717499-4-4-when-trying-to-update-ticket

it's a c# program. It throws the error here: using (myResponse = myRequest.GetResponse())

Here is the gist of it:

Stream requestStream = null;
var myRequest =
(HttpWebRequest)
WebRequest.Create("https://www.assembla.com/spaces/space-name/tickets/ticket-number");
myRequest.Credentials = GetCredentials();
myRequest.Method = "PUT";
myRequest.Accept = "application/xml";
myRequest.ContentType = "application/xml";
byte[] bytes;
var ticketString = new StringBuilder();
var settings = new XmlWriterSettings();
settings.OmitXmlDeclaration = true;
using (XmlWriter writer = XmlWriter.Create(ticketString, settings))
{
writer.WriteStartElement("ticket");
writer.WriteElementString("milestone-id", milestone.SelectSingleNode("id").InnerText);
writer.WriteElementString("assigned-to-id", id);
writer.WriteElementString("status", "Assigned");
writer.WriteEndElement(); //ticket
}
bytes = Encoding.ASCII.GetBytes(ticketString.ToString());
myRequest.ContentLength = bytes.Length;
requestStream = myRequest.GetRequestStream();

//Writes a sequence of bytes to the current stream
requestStream.Write(bytes, 0, bytes.Length);
WebResponse myResponse = null;
//Close stream
requestStream.Close();
var updatedTicket = new XmlDocument();
try
{
using (myResponse = myRequest.GetResponse())
{
using (var sr = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8)
)
{
updatedTicket.LoadXml(sr.ReadToEnd());

Stanislav K

unread,
Jan 13, 2014, 2:31:23 AM1/13/14
to assembla...@googlegroups.com
Hi Lindsay,

You're most likely using the old API, which is currently deprecated. I suggest you to switch to the new API. You can find more details about it at http://api-doc.assembla.com/ . As for this request, I can see two things:
* you can explicitly add .xml at the end of the URL (just in case)
* you should make sure that you put the correct space project URL and ticket number

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

Lindsay Ohman

unread,
Jan 13, 2014, 6:39:52 PM1/13/14
to assembla...@googlegroups.com
I was told that the deprecated api would not change as we have many programs that rely on it I refuse to rewrite them all.We pay a significant amount of money to Assembla per month. The live code has our space name and ticket number in it. The programs I wrote have been working for 2 years so I dont feel I should have to rewite them because someone made a change on the Assembla side.

Stanislav Kolotinskiy

unread,
Jan 14, 2014, 2:40:52 AM1/14/14
to assembla...@googlegroups.com
Hi Lindsay,

sure, it's up to you to decide what API version you'll use. Can you
please perform the same request with curl or any other similar tool and
post the output here? Or can you please write me a private message with
the actual space name and ticket number, so that I can try to debug the
issue as well?

Regards,
Stanislav

Lindsay Ohman

unread,
Jan 15, 2014, 5:08:13 PM1/15/14
to assembla...@googlegroups.com
https://www.assembla.com/spaces/glg-dev-request/tickets/7858

It fails on updating any ticket in this space. The program dynamically creates a milestone and tries to assign it to the ticket and change the status and assigned to. because it's been throwing a 404 I have been manually updating them. I also have other programs that seem to be failing but I haven't checked on them as I have been out on Maternity leave the past 8 weeks. This is impacting businesses so I am trying to address it even though I am still out.

Lindsay Ohman

unread,
Jan 17, 2014, 4:22:53 PM1/17/14
to assembla...@googlegroups.com
https://www.assembla.com/spaces/glg-dev-request/tickets/7803 is another example that it fails with a 404 although it exists..  The call is:

 Stream requestStream = null;
            HttpWebRequest myRequest =
                (HttpWebRequest)
                WebRequest.Create("https://www.assembla.com/spaces/glg-dev-request/tickets/7803");
            myRequest.Credentials = GetCredentials();
            myRequest.Method = "GET";
            myRequest.Accept = "application/xml";
            myRequest.ContentType = "application/xml";
            XmlDocument ticketsXML = new XmlDocument();

            try
            {
                using (WebResponse myResponse = myRequest.GetResponse())
                using (StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8))
                {
                    ticketsXML.LoadXml(sr.ReadToEnd());

Lindsay Ohman

unread,
Jan 20, 2014, 3:22:40 PM1/20/14
to assembla...@googlegroups.com
Attached image of the 404 returning from curl.
curl.JPG

je...@assembla.com

unread,
Jan 20, 2014, 4:31:48 PM1/20/14
to assembla...@googlegroups.com
Thank you Lindsay for the additional details.
Stan please help us figure out a solution to get this working as soon as possible.  What is the next step now?
We can try to schedule a group chat if it will be better to troubleshoot this with the customer live.
Thanks, Jeff

Stanislav Kolotinskiy

unread,
Jan 21, 2014, 5:29:52 AM1/21/14
to assembla...@googlegroups.com
Hi Lindsay,

I just checked logs on our side - looks like your auth credentials weren't recognized and the system was considering that request was made by anonymous user. I was able to perform the same request using my credentials and got a 200 response status. Can you please make sure that the credentials you're using are correct? Please try to wrap the URL into single quotes as well. Also, please try to change password and then try again. If that doesn't help, please let me know about when we can have a group chat for live debugging.

Regards,
Stanislav

Lindsay Ohman

unread,
Jan 21, 2014, 12:56:00 PM1/21/14
to assembla...@googlegroups.com
I will try and change the password. I verified the current credentials are correct. The odd thing is the same program creates milestones just fine with those credentials. I will post back when I have the chance to change the password and try again.

Lindsay Ohman

unread,
Jan 21, 2014, 2:51:03 PM1/21/14
to assembla...@googlegroups.com
Found more info - it seems something in some tickets are screwing it up when I want it returned as XML. I tweaked that call to use the API key & token to see if that made a difference and now it returns "Bad XML input".  When I change it to .json it returns an object ok.  I'm assuming this is the same issue with the old API but am not sure because it's just returning 404s.  Can you check that for me since it fails both in new and old api?
curl-ticket.JPG

Stanislav Kolotinskiy

unread,
Jan 21, 2014, 5:56:59 PM1/21/14
to assembla...@googlegroups.com

Hi Lindsay,

so here's the reason why the response is "Bad XML input" (the message is a bit erroneous, but the reason should still be clear) - XML doesn't allow a set of characters in tag names. Here's an excerpt from http://en.wikipedia.org/wiki/XML#Well-formedness_and_error-handling :
Tag names cannot contain any of the characters !"#$%&'()*+,/;<=>?@[\]^`{|}~, nor a space character, and cannot start with -, ., or a numeric digit.
We do not convert custom field names, and consequently invalid XML documents are generated (because some of the custom fields' names in glg-dev-request project contain question marks, parentheses and/or slashes) - we do not send invalid XML, displaying this message instead. We could send invalid XML markup, but that's a bad idea for many reasons (the first of them being the fact that customers don't like invalid data). I can propose you to switch to JSON, because it doesn't have these restrictions and would allow you to use our API in a better way. We will investigate the issue with old API as well and will fix it ASAP. Please let me know if that helps.

Regards,
Stanislav

Lindsay Ohman

unread,
Jan 22, 2014, 1:56:46 PM1/22/14
to assembla...@googlegroups.com
Makes complete sense, just wondering why it all of a sudden changed since it was never a problem before December. We did not alter anything in our code when it started failing (our programs run as scheduled tasks and as I mentioned before have been for about 2 years). It might also be best to disallow those characters when people create custom fields since there is no mention of it in the section they are created nor in the api documentation fur calling the api with xml results. Let me know what you find our about the old api changes. Thanks.

Sergiy Golub

unread,
Jan 22, 2014, 3:34:31 PM1/22/14
to assembla...@googlegroups.com
Hello, Lindsay.
sorry for confusion.
Just to confirm: had XML's with '?' or other unsupported characters worked ok for you before? We recently added some verification's of XML validity in order to make sure that XML's we generate are standard compatible and can be parsed by external parsers without problems.
Regards,
Sergiy.

Sergiy Golub

unread,
Jan 27, 2014, 6:46:46 AM1/27/14
to assembla...@googlegroups.com
Hello, Lindsay.

we made a fix and we checked all tickets from space you mentioned with old API -  with proper user credentials it is working for us right now.
Could you please confirm it works for you too?

Regards,
Sergiy.

Lindsay Ohman

unread,
Jan 27, 2014, 12:51:18 PM1/27/14
to assembla...@googlegroups.com
Sorry for the delay - I was out of work the rest of last week.  Yes XML with unsupported characters worked for 2 years up until December.  I'm assuming that is when you made the XML validity change to the code and that is why it has been failing since then.  I ran my program and am still getting a 404 for GET XML requests for tickets - here is one of them:
HttpWebRequest myRequest =
                (HttpWebRequest)
                WebRequest.Create("https://www.assembla.com/glg-dev-request/tickets/7566");
            myRequest.Credentials = GetCredentials(); (Which I've verified are my credentials).  

Stanislav Kolotinskiy

unread,
Jan 27, 2014, 1:22:42 PM1/27/14
to assembla...@googlegroups.com
Hi Lindsay, looks like your URL is wrong - it should be https://www.assembla.com/spaces/glg-dev-request/tickets/7566 - you missed spaces. Can you please fix and recheck?

--
Regards,
Stanislav
--

Lindsay Ohman

unread,
Jan 28, 2014, 6:51:44 PM1/28/14
to assembla...@googlegroups.com
Sorry had a typo - updated it to spaces and it still throws a 404.

Message = "The remote server returned an error: (404) Not Found."
Reply all
Reply to author
Forward
0 new messages