Changing Importance via API

John Wulff's Avatar

John Wulff

23 May, 2013 06:49 PM

I cannot seem to modify ticket importance via the API. I'm using the lighthouse-api 2.0 rubygem.

Here's an example:

1.9.3p392 :021 > t = Lighthouse::Ticket.find 652, params: { project_id: 52600 }
 => #<Lighthouse::Ticket:0x007f9dbd4ff468 ...
1.9.3p392 :022 > t.importance 
 => 2 
1.9.3p392 :023 > t.importance = 1
 => 1 
1.9.3p392 :024 > t.save!
 => true 
1.9.3p392 :025 > t = Lighthouse::Ticket.find 652, params: { project_id: 52600 }
 => #<Lighthouse::Ticket:0x007f9dc180e100 ...
1.9.3p392 :026 > t.importance 
 => 2
  1. 1 Posted by Nicole on 23 May, 2013 07:45 PM

    Nicole's Avatar

    John -

    Are you using https://github.com/entp/lighthouse-api? If not, the other isn't maintained by us and doesn't look like it's been updated since 2010. Let us know and we'll continue troubleshooting with you.

    Thanks,
    Nicole

  2. 2 Posted by John Wulff on 23 May, 2013 08:13 PM

    John Wulff's Avatar

    https://github.com/entp/lighthouse-api and http://rubygems.org/gems/lighthouse-api being two different things is very confusing. It looks like the difference between the original repo and the one your maintaining isn't significant. https://github.com/entp/lighthouse-api/compare/Caged:master...master

    Anyway, I've switched to git://github.com/entp/lighthouse-api.git instead of what RubyGems thinks lighthouse-api is and I'm getting the exact same behavior as demonstrated in the console paste in my first message.

    I've also tried using curl and minimal XML to isolate the problem. Here's what I tried (I've omitted irrelevant portions of the XML responses):

    ~ $ curl -H 'X-LighthouseToken: XXX' https://orcasnet.lighthouseapp.com/projects/52600/tickets/652.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ticket>
      <importance type="integer">2</importance>
      
    ~ $ curl -H 'X-LighthouseToken: XXX' -X PUT --data '<ticket><importance type="integer">1</importance></ticket>' https://orcasnet.lighthouseapp.com/projects/52600/tickets/652.xml
    
    ~ $ curl -H 'X-LighthouseToken: XXX' https://orcasnet.lighthouseapp.com/projects/52600/tickets/652.xml
    <ticket>
      <importance type="integer">2</importance>
    

    This shows that the importance change is indeed not being applied.

    Thanks for your help, really appreciate it!

  3. 3 Posted by John Wulff on 23 May, 2013 08:37 PM

    John Wulff's Avatar

    I've just noticed in your API documentation (http://help.lighthouseapp.com/kb/api/tickets) it says you only support the following fields for ticket POST (creation).

    title
    body - follows the same formatting rules.
    state - Can be any one of these: new, open, resolved, hold, invalid. Optional, set to open by default for new tickets.
    assigned-user-id - optional
    milestone-id - optional
    tag - space or comma delimited list of tags
    

    Do you only support these fields for PUT (update) as well? That may explain why importance changes are not taking.

    I know we used to be able to set priority but I think when priority was renamed to importance we lost the ability to set importance via the API.

  4. 4 Posted by Julien on 23 May, 2013 09:11 PM

    Julien's Avatar

    Hi John,

    There is a significant difference between Caged and entp:

    + self.format = :xml
    

    That sets the content type to XML. The Caged version will send XML but it will be interpreted as text, and so won't work.

    Regarding the importance field, if you are using the gem, you can use priority instead: it will set the importance. If you are using curl, using importance directly will work. Your example failed because you didn't send a content type of XML.

    Let me know how it goes with these changes.

  5. 5 Posted by John Wulff on 23 May, 2013 09:13 PM

    John Wulff's Avatar

    Well! It looks like reverting back to priority for PUT and POST purposes has fixed things. We still need to use the new importance field for properly "reading"

    Thanks Julien!

  6. Julien closed this discussion on 23 May, 2013 09:32 PM.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac