简体   繁体   English

使用ebay在网站中连接API

[英]connecting API in website using ebay

How can I connect api with websites? 如何将api与网站连接?

I am new to the eBay API and currently developing in PHP, I have managed to use GetItem to import details of an order based on the Item ID to my website's database. 我是eBay API的新手,当前使用PHP开发,我设法使用GetItem将基于Item ID的订单详细信息导入到我的网站的数据库中。 But What I want to do now is to link a users account to my website and import their listings to my database. 但是,我现在要做的是将用户帐户链接到我的网站,并将他们的列表导入我的数据库。 I have put the code I used for GetItem (below) but now I am stuck and I don't know what to use, GetAccount , GetUser or GetSellerList . 我已经放入了用于GetItem的代码(如下),但是现在我卡住了,我不知道该使用什么, GetAccountGetUserGetSellerList

if you want all items of a user and you have access to his auth token you could use the getMyEbaySelling call that will return you all items of the user. 如果您需要用户的所有项目,并且可以访问他的身份验证令牌,则可以使用getMyEbaySelling调用,该调用将返回您用户的所有项目。

(explainations + examples can be found here: Can I edit A third party ebay seller's item from his seller list by API? ) (可在此处找到说明和示例: 我可以通过API从卖家列表中编辑第三方eBay卖家的商品吗?

if you want to retrieve items from "3rd party" users from which you only have the user/account name you will need to go with the getSellerListing call can retrieve items listed by this seller. 如果您想从“第三方”用户那里检索项目,而您仅拥有该用户名/帐户名,则需要使用getSellerListing调用才能检索该卖方列出的项目。 (executeable example here: https://ebay-sdk.intradesys.com/s/c0c7c76d30bd3dcaefc96f40275bdc0a ) (此处的可执行示例: https : //ebay-sdk.intradesys.com/s/c0c7c76d30bd3dcaefc96f40275bdc0a

depending on what you want to display on your website you will need to see if those informations are already contained within the response or you will need to call the getItem call for each item to retrieve additional informations that are missing 根据您要在网站上显示的内容,您需要查看响应中是否已包含这些信息,或者您需要为每个项目调用getItem调用以检索缺少的其他信息

Here you go Arjun 妳去阿俊

eBay returns 200 items in one page for one api call eBay在一个API调用的一页中返回200个项目

$feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<GetMyeBaySellingRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>$auth_token</eBayAuthToken>
</RequesterCredentials>
<ActiveList>
<Sort>Title</Sort>
<IncludeNotes>FALSE</IncludeNotes>
<Pagination><EntriesPerPage>200</EntriesPerPage>
<PageNumber>$pageNo</PageNumber>
</Pagination>
</ActiveList>
<HideVariations>FALSE</HideVariations>
<DetailLevel>ReturnAll</DetailLevel>
<MessageID>1</MessageID>
<Version>899</Version>
<WarningLevel>High</WarningLevel>
</GetMyeBaySellingRequest>​
EOD;


$feed = trim($feed);
$headers = array
(
'X-EBAY-API-COMPATIBILITY-LEVEL: 899',
    'X-EBAY-API-DEV-NAME: ' . $dev_id,
    'X-EBAY-API-APP-NAME: ' . $app_id,
    'X-EBAY-API-CERT-NAME: ' . $cert_id,
    'X-EBAY-API-CALL-NAME: GetMyeBaySelling',
    'X-EBAY-API-SITEID: 3'//3 For UK
);

// Send request to eBay and load response in $response
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, "https://api.ebay.com/ws/api.dll");
curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
curl_setopt($connection, CURLOPT_POST, 1);
curl_setopt($connection, CURLOPT_POSTFIELDS, $feed);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($connection);
curl_close($connection);

$xml = simplexml_load_string($response);
...
...
?>

I would also take a look at the difference between getsellerlist and getmyebayselling. 我还将看看getsellerlist和getmyebayselling之间的区别。 I do not think getmyebayselling can retrieve things like the users store categories, but getsellerlist can. 我认为getmyebayselling不能检索用户存储类别之类的东西,但是getsellerlist可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM