All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sphere.sdk.meta.GettingStarted Maven / Gradle / Ivy

There is a newer version: 1.0.0-M26
Show newest version
package io.sphere.sdk.meta;

import io.sphere.sdk.models.Base;

/**
 

About the clients

The SPHERE.IO client communicates asynchronously with the SPHERE.IO API via HTTPS and it takes care about authentication.

The client uses Java objects to formulate an HTTP request, performs the request and maps the JSON response into a Java object. The resulting Java object is not directly accessible as object, but it is embedded in a Future/Promise for asynchronous programming. Since the client is thread-safe you need only one client to perform multiple requests in parallel.

There are different SPHERE.IO client flavors for different future implementations:

Clients and future implementations
ClientFuture implementation
{@link io.sphere.sdk.client.SphereClient} (default){@code java.util.concurrent.CompletionStage}
SphereScalaClient{@code scala.concurrent.Future}
SpherePlayJavaClient{@code play.libs.F.Promise}

Preparation

You need to create a project in SPHERE.IO first. After that you need to go to the "Developers" section and open the tab "API clients". There you'll find the credentials to access the project with the client.

This is an example for the client credentials page (client secret has been modified):

Merchant Center with project credentials view

For this example the configuration values are:

project key: jvm-sdk-dev-1
client ID: ELqF0rykXD2fyS8s-IhIPKfQ
client secret: 222222222222222222222222222222226

Instantiation

{@include.example example.JavaClientInstantiationExample}

Perform requests

A client works on the abstraction level of one HTTP request for one project. With one client you can start multiple requests in parallel, it is thread-safe.

The client method {@link io.sphere.sdk.client.SphereClient#execute(io.sphere.sdk.client.SphereRequest)} takes a {@link io.sphere.sdk.client.SphereRequest} as parameter.

You can create a {@link io.sphere.sdk.client.SphereRequest} yourself or use the predifined ones listed on {@link io.sphere.sdk.meta.SphereResources}.

Example:

{@include.example example.TaxCategoryQueryExample#exampleQuery()}

Closing the client

The client holds resources like thread pools and IO connections, so call {@link io.sphere.sdk.client.SphereClient#close()} to release them.

Further client information

  • {@link SphereClientTuningDocumentation Tuning the client}
  • {@link io.sphere.sdk.meta.TestingDocumentation Writing unit tests with the client}
*/ public final class GettingStarted extends Base { private GettingStarted() { } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy