# JSON-RPC 2.0

The main interface to our API is JSON-RPC 2.0 (opens new window) over HTTP or WebSocket.

Under Clients, you find JSON-RPC-2.0-client libraries in various languages. Since JSON-RPC is a very simple protocol, the basic client is easy to implement in any language. With JSON-RPC over HTTP, you POST a simple JSON object and get a JSON object in return.

# JSON-RPC over HTTP

The URL is https://shop.textalk.se/backend/jsonrpc/v1/ but the API is also accessible over HTTP (unencrypted) and on your own shop domain as well, on /backend/jsonrpc/v1/.

# Main URL

https://shop.textalk.se/backend/jsonrpc/v1/

# Unencrypted

http://shop.textalk.se/backend/jsonrpc/v1/

# Custom shop domain

http://yourshop.example.com/backend/jsonrpc/v1/

To get an object-oriented approach, we use the notation Class.method and all instance methods have the instance's unique identifier as its first parameter.

# Example

A request to the get method on an Order with the unique identifier 1234 could look like this:

    # Context parameters

    All requests are made in a context. The API will take context parameters from both GET parameters and cookies. So the URL...

    https://shop.textalk.se/backend/jsonrpc/v1/?webshop=22222&language=sv
    

    ...will set the context

    Parameter Value
    webshop 22222
    language sv

    # Available context parameters

    Parameter Description
    webshop The webshop ID. This identifies which webshop we are working with and is required for articles, articlegroups, orders, customers, sessions and everything else that belongs to a certain webshop. Only some of the system-wide API methods do not require a webshop in the context.
    language A two-letter ISO 639-1 code. Sets the wanted language for API metadata. If no language is provided in the query string then try to default it using the following heuristic: If the webshop has a default language set, use that as the contexts language. Otherwise default to english.
    auth An admin token. The token is used to identify an admin and can be acquired from Auth.getToken
    session A session token. The token is used to identify a current buyer and can be acquired from Session.getToken

    # TLS on shop.textalk.se

    Everything available on http://shop.textalk.se can be accessed through TLS at https://shop.textalk.se as well. This allows you to use all the resources through TLS on a secure page and avoid warnings.

    The API will always deliver absolute URLs with the HTTP schema, where the format dictates URI.

    # Example

    The image URL for an Article.

    https://shop.textalk.se/shop/22222/art22/h5484/12565484-origpic-4e3233.jpg