// guide
SDKs
Every endpoint, as a typed method in your language. The libraries are generated from the same API description as the reference, so they are never behind it.
Install
| language | install | source |
|---|---|---|
| TypeScript, Node and browsers | npm install @marketsdk/js | github.com/focussofthq/marketsdk-typescript |
| Python | pip install marketsdk | github.com/focussofthq/marketsdk-python |
| Go | go get github.com/focussofthq/marketsdk-go | github.com/focussofthq/marketsdk-go |
| Java | com.marketsdk:marketsdk-java on Maven Central | github.com/focussofthq/marketsdk-java |
| C# | dotnet add package MarketSDK | github.com/focussofthq/marketsdk-csharp |
| PHP | composer require marketsdk/php | github.com/focussofthq/marketsdk-php |
All six are MIT licensed. Each repository's README has the full usage guide for its language.
A first call
Pass a test key once. The key decides the marketplace and the mode, so there is nothing else to configure. This creates a seller:
import { MarketSDK } from "@marketsdk/js";
const client = new MarketSDK({ token: process.env.MARKETSDK_KEY });
const seller = await client.sellers.createSeller({ external_id: "user_42" });from marketsdk import MarketSDK
client = MarketSDK(token=os.environ["MARKETSDK_KEY"])
seller = client.sellers.create_seller(external_id="user_42")import (
marketsdk "github.com/focussofthq/marketsdk-go"
"github.com/focussofthq/marketsdk-go/client"
"github.com/focussofthq/marketsdk-go/option"
)
c := client.NewClient(option.WithToken(os.Getenv("MARKETSDK_KEY")))
seller, err := c.Sellers.CreateSeller(ctx, &marketsdk.CreatePartyDto{ExternalID: "user_42"})import com.marketsdk.MarketSDK;
import com.marketsdk.types.CreatePartyDto;
MarketSDK client = MarketSDK.builder().token(System.getenv("MARKETSDK_KEY")).build();
SellerObject seller = client.sellers().createSeller(
CreatePartyDto.builder().externalId("user_42").build());using MarketSDK;
var client = new MarketSDKClient(Environment.GetEnvironmentVariable("MARKETSDK_KEY"));
var seller = await client.Sellers.CreateSellerAsync(new CreatePartyDto { ExternalId = "user_42" });use MarketSDK\MarketSDKClient;
use MarketSDK\Types\CreatePartyDto;
$client = new MarketSDKClient(getenv('MARKETSDK_KEY'));
$seller = $client->sellers->createSeller(new CreatePartyDto(['externalId' => 'user_42']));What every library does
- Sends your key as
Authorization: Beareron every call. - Lets you set headers per request, which is how you send an
Idempotency-Keyon a POST. - Ignores response fields it does not know, and passes through values it does not know, so an addition to the API never breaks you.
- Raises or returns a typed error carrying the envelope's
code,message,param, andrequest_id. - Retries only on 408, 429, and 5xx responses, honouring
Retry-After. - Makes no request to anything but the API, and collects nothing.
In the browser
The TypeScript library runs in a browser as well as in Node. Use a publishable key there, never a secret key: the API refuses a secret key sent from a browser. A publishable key reaches published listings, search, and public seller profiles, and nothing else. See authentication.
Versions
Each library has its own version number, starting at 1.0.0, and every release says which version of the API description it was generated from. What counts as a breaking change in a library is on the versioning page.
Something wrong?
Open an issue on the library's repository. Nothing in a library is written by hand, so the fix goes into the generator and every library is regenerated together.