Attaching image using API

Simon Petrik's Avatar

Simon Petrik

14 Oct, 2014 04:19 PM

I want to attach image when creating a ticket using API.
Could you help me about this?
It's OK to send me document related to this requirement.

Thanks,

  1. Support Staff 1 Posted by Tiger Team on 14 Oct, 2014 04:26 PM

    Tiger Team's Avatar

    Hi Simon,.

    You can send a file upload to ticket[attachment]

  2. 2 Posted by Simon Petrik on 14 Oct, 2014 04:41 PM

    Simon Petrik's Avatar

    I want to attach image via API.
    Please explain in more detailed.

  3. 3 Posted by Julien on 14 Oct, 2014 05:40 PM

    Julien's Avatar

    Hey Simon,

    It depends on the programming language you are using, but here is a simple example with curl:

    curl -X PUT \
       -H "X-LighthouseToken: API_KEY" \
       -F "ticket[body]=Adding an attachment" \
       -F "ticket[attachment][]=@screenshot.png" \
       https://ACCOUNT.lighthouseapp.com/projects/XXXXX/tickets/XXXX.json
    

    The only caveat is that you need to modify the body, or any other field aside "attachment" to create a new comment. Simply attaching the file itself with no other change won't work.

    I used the API key method of authentication, but of course the user/password method would work as well.

    Let me know if you have any question.

  4. 4 Posted by Nicole on 21 Oct, 2014 07:12 PM

    Nicole's Avatar

    Simon -

    Let us know if you have any other questions about using the API for attachments.

    Thanks,
    Nicole

  5. Nicole closed this discussion on 21 Oct, 2014 07:12 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