skip to Main Content

I am using ebay-sdk for python. I uploaded some images to eBay Picture Services(EPS) successfully using the below code:

from ebaysdk.trading import Connection as Trading

api = Trading(config_file='ebay.yaml', siteid=71)


def upload_images(image_url):
    response = api.execute('UploadSiteHostedPictures', {"ExternalPictureURL": image_url,
                                                             "PictureSet": "Supersize"})
    return response.content

upload_images(MY_IMG_URL)

eBay returns the URL of the uploaded images.

But how can I add the images to my existing eBay offers? Do I have to use ReviseItem?

An example using the ebay-sdk for python would be nice.

Edit:

    def revise_image(self, item_id):
    myitem = {
        "Item": {
            "Country": "DE",
            "ItemID": item_id,
            "PictureDetails": [
                {"PictureURL": MY_IMG1},
                {"PictureURL": MY_IMG2},
                {"PictureURL": MY_IMG3}
            ]
        }
    }
    response = self.api.execute('ReviseFixedPriceItem', myitem)

I made the changes as suggested but it still only changes the main image. MY_IMG3 becomes the main image. MY_IMG1 and MY_IMG2 are not appended to the listing.

2

Answers


  1. This works.

    def verifyAddItem(args):
            #"""http://www.utilities-online.info/xmltojson/#.UXli2it4avc   """
        try:
            api = Trading(debug=args.debug, siteid=site_id, appid=app_id, token=token_id, config_file=None, certid=cert_id, devid=dev_id)
    
            myitem = {
                "Item": {
                    "Country": "GB",
                    "Description": description,
                    "ItemID": item_to_revise,
                    "PictureDetails": {
                        "PictureURL": "http://www.itcircleconsult.com/eb2017/4a.png"
                        },
                    }
                }
    
            api.execute('ReviseFixedPriceItem', myitem)
            dump(api)
    

    I have been working a lot with eBay and Python..

    Check here for some working examples.. I often rip them apart and put them back together on the fly but you might find some use..

    There is an I-ways checker and some BS4 ripping to revise items as well

    https://github.com/johnashu/PRODUCTION/tree/master/Python/eBay%20API%20KIT%20-%20Maffas%20-%202017

    another useful thing is check out the eBay API call index here:

    http://developer.ebay.com/devzone/xml/docs/Reference/eBay/index.html#CallIndex

    then use an XML to JSON convertor to change the calls you need into a more readable format in pythong..

    Here:

    http://www.utilities-online.info/xmltojson/#.WTW_P8b-vct

    NOTES ON ADDING IMAGES AND HOSTING:

    https://developer.ebay.com/devzone/xml/docs/reference/ebay/UploadSiteHostedPictures.html

    Note: As of release 889, you do not need to use this call to upload self-hosted images before creating the listing. You can now specify up to 12 self-hosted or EPS hosted URLs at once in Item.PictureDetails.PictureURL using the AddItem or AddFixedPriceItem calls. However, you must use the UploadSiteHostedPictures call to upload binary attachments.

    The supposed JSON needed it this.. unless it takes time to populate the pictures to the item?

    We were both Missing [] – Schoolboy error!

    {
    "Item": {
        "PictureDetails": [
        { "PictureURL": "http://pics.ebay.com/aw/pics/dot_clear.gif" },
        { "PictureURL": "fds" },
        { "PictureURL": "fds" }
        ]
    }
    }
    
    Login or Signup to reply.
  2. I know this question is quite old, but I stumbled across this page because I ran into the same problem and found the correct solution.

    As mentioned in the comments above, the currently posted solution by johnashu does not work. This is because of the way ebaysdk.utils.dict2xml converts dictionaries.

    The above solution of:

    {
    "Item": {
        "PictureDetails": [
        { "PictureURL": "http://pics.ebay.com/aw/pics/dot_clear.gif" },
        { "PictureURL": "fds" },
        { "PictureURL": "fds" }
        ]
    }
    }
    

    Outputs XML of:

    <Item>
      <PictureDetails>
        <PictureURL>http://pics.ebay.com/aw/pics/dot_clear.gif</PictureURL>
      </PictureDetails>
      <PictureDetails>
        <PictureURL>fds</PictureURL>
      </PictureDetails>
      <PictureDetails>
        <PictureURL>fds</PictureURL>
      </PictureDetails>
    </Item>
    

    Which includes multiple <PictureDetails> rather than one parent tag, with multiple PictureURL tags as children.

    The correct format is:

    {
      "Item": {
        "PictureDetails": {
          'PictureURL': ['http://pics.ebay.com/aw/pics/dot_clear.gif', 'fds', 'fds']
        }
      }
    }
    

    Which gives us an XML output of:

    <Item>
      <PictureDetails>
        <PictureURL>http://pics.ebay.com/aw/pics/dot_clear.gif</PictureURL>
        <PictureURL>fds</PictureURL>
        <PictureURL>fds</PictureURL>
      </PictureDetails>
    </Item>
    

    Which matches the format described in the ReviseItem API docs.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search