Support

  • 1.  Download Images

    Posted 10-21-2021 08:12

    Hi All!!

    We are trying to download images from Jama text items, text items where properly exported by filtering  the output of:

                    j_proj.jama_client.get_abstract_items(project=j_proj.project_id, item_type=t_id)         

    then attachment path has been extracted from text item description

    example: "https://OurUrl/attachment/1234/file.png"

    then we are trying to download the attachment by :

                   jamaclient.get_attachment(attachmentId)

    if

      attachmentId=1234

    then

    this error appears:

    API Client Error. Status: 404 Message: This resource does not exist.

     

    if

      attachmentId=1234/file.png

    then

    this error appears:

    API Client Error. Status: 404 Message: This resource does not exist.

     

    Do you know what are we doing wrong?

     

    PS: the image can be download from the web browser using example path.

     

    Thanks!

    Ivan



    ------------------------------
    Ivan Cejudo Gomez
    Monolithic Power System
    Barcelona
    ------------------------------


  • 2.  RE: Download Images

    Posted 10-21-2021 12:00
    Hi Ivan,

    I had your same problem in the past.
    If I remember correctly, you have to use the API ID of the attachment in performing GET /attachments/{Id}

    Best,
    Alessandro

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------



  • 3.  RE: Download Images

    Posted 10-21-2021 12:16
    Now!
    Try to use GET /files and pass the the url to the parameters. In the URL you have the attachmentId.
    I hope it helps...
    Best,
    Alessandro

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------



  • 4.  RE: Download Images

    Posted 10-21-2021 23:50
    Hi! Sorry for the delay for reply!

    I think understand the concept.

    I try to:
    -jamaclient.get_attachment(attachmentID) ->Error resource not exist
    -jamaclient.get_attachment(attachmentID/file) ->Error resource not exist
    -jamaclient.get_attachment(attachmentID/files) ->Error resource not exist
    -jamaclient.get_attachment(ALL_URL/attachmentid/file)-> 500 Server error
    -jamaclient.get_attachment(ALL_URL/attachmentid/files)-> 500 Server error
    -jamaclient.get_attachment(ALL_URL/attachmentID)-> 500 Server error

    When you say GET /files ... you mean that?

    Thanks!!

    Rewards!

    Ivan.

    ------------------------------
    Ivan Cejudo Gomez
    Monolithic Power System
    Barcelona
    ------------------------------



  • 5.  RE: Download Images

    Posted 10-22-2021 00:35
    Edited by Alessandro 10-22-2021 00:41
    Good morning Ivan,
    it is another endpoint of the REST API.
    You'd better to test with swagger -> you can see all the endpoints ;-)
    Swagger

    For the available endüpoints you can give a look here : https://dev.jamasoftware.com/
    Best,
    Alessandro

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------



  • 6.  RE: Download Images

    Posted 10-22-2021 01:41
    Edited by Ivan 10-22-2021 03:20
    Yes.
    Check the documentation at https://dev.jamasoftware.com and read endpoint get / attach / attachid / file to download images, but in my script they show errors (in the post above), I don't see practical examples and I don't know how focus / do it.
    Sorry for the lost time!

    PD:Using Python!

    Rewards

    Ivan.


    ------------------------------
    Ivan Cejudo Gomez
    Monolithic Power System
    Barcelona
    ------------------------------



  • 7.  RE: Download Images

    Posted 10-22-2021 07:01
    You have to build your own function if not available -> check Swagger and build the GET accordingly
    Suggestion :
    • imageurl = jamurl + '/attachment/' + id + '/' + filename
    • resource_path = 'files'
    • params = {'url' : imageurl}
    • response = jama_client._JamaClient__core.get(resource_path, params)
    • respose.content should be the image that can be stored in a file.
    It should work...

    Best,
    Alessandro

    ------------------------------
    Alessandro
    Systems Engineer
    SICK AG
    ------------------------------



  • 8.  RE: Download Images

    Posted 10-22-2021 07:06

    Ty Alessandro!!!

    Very very thanks!

    Finally got it!!

    Rewards!

    Ivan



    ------------------------------
    Ivan Cejudo Gomez
    Monolithic Power System
    Barcelona
    ------------------------------