cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

VerifyAddFixedPriceItem Token Validation works on API Explorer Fine, but won't verify in Python?

When i'm working in the VerifyAddFixedPriceItem on the API Explorer, i'm able to use my Token and get return information for fee figuring and such. But when I use my python function, i get an issue with the token. I've tried many variations but it's as if i'm having an encoding issue or something of the point. I've taken code directly from the explorer and applied it, but the token is still an issue even though my token is good and working. Here is my code, and what i get.

 

 

 

import requests,item_building

EBAY_API_URL = "https://api.sandbox.ebay.com/ws/api.dll"

APP_ID = item_building.APP_ID
DEV_ID = item_building.DEV_ID
CERT_ID = item_building.CERT_ID
USER_TOKEN = "XXXXXXXXXXX"

headers = {
    "X-EBAY-API-CALL-NAME": "VerifyAddFixedPriceItem",
    "X-EBAY-API-SITEID": "0",
    "X-EBAY-API-COMPATIBILITY-LEVEL": "967",  # Ensure compatibility matches
    "X-EBAY-API-DEV-NAME": DEV_ID,
    "X-EBAY-API-APP-NAME": APP_ID,
    "X-EBAY-API-CERT-NAME": CERT_ID,
    "Content-Type": "text/xml"
}

xml_body = f"""<?xml version="1.0" encoding="utf-8"?>
<VerifyAddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
        <eBayAuthToken>{USER_TOKEN}</eBayAuthToken>
    </RequesterCredentials>
    <ErrorLanguage>en_US</ErrorLanguage>
    <WarningLevel>High</WarningLevel>
    <Item>
        <Title>Apple MacBook Pro MB990LL/A 13.3 in. Notebook NEW</Title>
        <PrimaryCategory>
            <CategoryID>111422</CategoryID>
        </PrimaryCategory>
        <StartPrice>5000.0</StartPrice>
        <CategoryMappingAllowed>true</CategoryMappingAllowed>
        <ConditionID>1000</ConditionID>
        <Country>US</Country>
        <Currency>USD</Currency>
        <DispatchTimeMax>3</DispatchTimeMax>
        <ListingDuration>GTC</ListingDuration>
        <ListingType>FixedPriceItem</ListingType>
        <PictureDetails>
            <GalleryType>Gallery</GalleryType>
            <PictureURL>https://i5.walmartimages.com/asr/5d2d639b-fa35-4525-a980-cc44a12b7f78_1.46d6ef8c1c6215c13baf4c1af65186f4.jpeg</PictureURL>
        </PictureDetails>
        <PostalCode>95125</PostalCode>
        <ProductListingDetails>
            <UPC>885909298594</UPC>
            <IncludeStockPhotoURL>true</IncludeStockPhotoURL>
            <IncludeeBayProductDetails>true</IncludeeBayProductDetails>
            <UseFirstProduct>true</UseFirstProduct>
            <UseStockPhotoURLAsGallery>true</UseStockPhotoURLAsGallery>
            <ReturnSearchResultOnDuplicates>true</ReturnSearchResultOnDuplicates>
        </ProductListingDetails>
        <Quantity>6</Quantity>
        <Site>US</Site>
        <SellerProfiles>
            <SellerPaymentProfile>
                <PaymentProfileID>313035107022</PaymentProfileID>
            </SellerPaymentProfile>
            <SellerReturnProfile>
                <ReturnProfileID>34648598022</ReturnProfileID>
            </SellerReturnProfile>
            <SellerShippingProfile>
                <ShippingProfileID>313166455022</ShippingProfileID>
            </SellerShippingProfile>
        </SellerProfiles>
    </Item>
</VerifyAddFixedPriceItemRequest>
"""

response = requests.post(EBAY_API_URL, headers=headers, data=xml_body)

print("Status Code:", response.status_code)
print("Response Text:", response.text)
"""

response = requests.post(EBAY_API_URL, headers=headers, data=xml_body)

print("Status Code:", response.status_code)
print("Response Text:", response.text)

 

 

 

 

This is what i get:

 

 

 

Status Code: 200
Response Text: 
‌‌apis:eBLBaseComponents">2024-10-26T02:04:02.995ZFailureAuth token is invalid.Validation of the authentication token in API request failed.931ErrorRequestError1363E1363_UNI_API5_19110891_R1

 

 

 

 

Can somebody please tell me whats going on because i've tried my own troubleshooting. AI code verifications, and other samples. Nothing. It seems to be something missed in translation from the API Explorer to the python codel

Message 1 of 2
latest reply
1 REPLY 1

VerifyAddFixedPriceItem Token Validation works on API Explorer Fine, but won't verify in Python?

Hi @thebierfamily,

 

You can refer to the Knowledge Base article here,  to get the detailed information on Error 931 - Auth Token is Invalid.

Best Regards,
eBay Developer Support
Message 2 of 2
latest reply