Skip to content

Uploading Product Images VIA API and Primary Image Wanted Not Showing as Primary #1228

Answered by slider1234
slider1234 asked this question in Q&A
Discussion options

You must be logged in to vote

i figured it out. It needed a "rank". i didn't even know that existed until now.

here is a simplified version made in Python if anyone else runs into the same problem.

`import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder

API_KEY = 'your_api_key'
OAUTH_TOKEN = 'your_oauth_token'
SHOP_ID = 'your_shop_id'
LISTING_ID = 'your_listing_id'

primary_image_path = 'path/to/your/primary_image.png' # This will be set as the primary image (rank 1)
second_image_path = 'path/to/your/second_image.png'
third_image_path = 'path/to/your/third_image.png'

def upload_image(listing_id, file_path, rank):
"""Uploads an image to the specified listing with a specified rank."""
url = f'ht…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by slider1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant