When using the XML version of the Trading API, calls can be authenticated as follows:
-
Authentication token
To authenticate the requester for a call using an authentication token, pass the token in the
eBayAuthToken
element within theRequesterCredentials
element in the request XML:<?xml version="1.0" encoding="utf-8"?> <GeteBayOfficialTimeRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <RequesterCredentials> <eBayAuthToken>
Token goes here
</eBayAuthToken> </RequesterCredentials> <Version>1081</Version> </GeteBayOfficialTimeRequest>A sample delivered with the eBay SDK for Java shows how to add this element in Java and populate it with an authentication token. Specifically, refer to the
Global.java
file in thesigningredirect
folder in the eBay SDK for JavaWhen using the eBay SDK for Java, pass the authentication token for the requesting user in the
ApiCredential
property of theApiContext
object used for the call. TheApiContext.ApiCredential.eBayToken
property holds the authentication token for a call. The authentication token is passed in the variabletoken
, which is of typestring
. For an example in Java, refer to theGlobal.java
file in thesigningredirect
folder in the eBay SDK for JavaIn the eBay SDK for .NET, pass the authentication token for the requesting user in the
ApiCredential
property of theApiContext
object used for the call. TheApiContext.ApiCredential.eBayToken
property holds the authentication token for a call. In the following example the authentication token is passed in the variabletoken
, which is of typestring
.// Create the ApiContext object and specify the credentials ApiContext context = new ApiContext(); context.ApiCredential.ApiAccount.Application = "YourAppId"; context.ApiCredential.ApiAccount.Certificate = "Your"; context.ApiCredential.ApiAccount.Developer = "YourDevID"; context.ApiCredential.eBayToken = "ABC...123";
-
Full keyset and session ID
The use of the full application keyset (i.e.,
DevID
,AppID
, andAuthCert
,) to authenticate the requester of a call is not required for most calls. However, the following calls, which are associated with authentication and tokens, require that these keyset values be included in the request header:The following example illustrates XML header elements that contain the keyset-based authentication data:
X-EBAY-API-COMPATIBILITY-LEVEL: 1081 X-EBAY-API-DEV-NAME:YourDevID X-EBAY-API-APP-NAMEYourAppID X-EBAY-API-CERT-NAME:YourCertID X-EBAY-API-CALL-NAME:FetchToken X-EBAY-API-SITEID:0 Content-Type:text/xml Request Payload: <?xml version="1.0" encoding="utf-8"?> <FetchTokenRequest xmlns="urn:ebay:apis:eBLBaseComponents"> <Version>1081</Version> <SessionID>MySessionID</SessionID> </FetchTokenRequest>
A sample delivered with the eBay SDK for Java shows how to pass authentication data based on your eBay Developer's Program credentials in Java. Specifically, refer to the
ClientAuthenticationHandler.java
file in thehandler
folder of the eBay SDK for Java.When using the eBay SDK for Java, pass your eBay Developer's Program credentials within an API call request in the
ApiCredential
property of theApiContext
object. TheApiCredential
object has anApiAccount
property to contain the application's credentials and aneBayAccount
property to hold the requesting user's eBay Developer's Program credentials. These are used to authenticate the user for the call. Variables are used for the application's credentials (i.e.,mDevID
,mAppID
, andmCert
,) and for the eBay Developer's Program credentials. The variables are all of typeString
.When using eBay SDK for .NET, pass your eBay Developer's Program credentials within an API call request in the
ApiCredential
property of theApiContext
object. TheApiCredential
object has anApiAccount
property to contain the application's credentials and aneBayAccount
property to hold the requesting user's eBay Developer's Program credentials which are used to authenticate the user for the call. The variables used to express the application's credentials (i.e.,devID
,appID
, andcert
,) and the variables containing the eBay Developer's Program credentials are all of typestring
.