NAV -image
bash javascript php

Introducción

Esta documentación tiene como objetivo proporcionar toda la información que necesita para trabajar con nuestra API.

Base URL

https://api-qa-mercurio.scry.cl

Autenticación

La autenticación del API es por tienda, consigue tu token contactando a contacto@scry.cl

Endpoints

Buscar una carta

Este endpoint permite buscar una carta en todo el catalogo de scry.cl

Example request:

curl -X GET \
    -G "/v1/card/search?term=Aberrant&order=desc&field=stock&limit=1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "/v1/card/search"
);

let params = {
    "term": "Aberrant",
    "order": "desc",
    "field": "stock",
    "limit": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->get(
    '/v1/card/search',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'query' => [
            'term'=> 'Aberrant',
            'order'=> 'desc',
            'field'=> 'stock',
            'limit'=> '1',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (201):

[
    {
        "id": 135777,
        "name": "Hechicera de mente extraña - Aberrant Mind Sorcerer",
        "description": "",
        "edition": "Adventures in Forgotten Realms",
        "store_id": 1,
        "price": 150,
        "stock": 31,
        "image": "https:\/\/www.magic4ever.cl\/images\/AFR\/Aberrant Mind Sorcerer.jpg",
        "link": "https:\/\/www.magic4ever.cl\/product_info.php?products_id=89851&osCsid=27b95860598c0ec3b29a658a8a1dae07",
        "link_edition": "",
        "external_id": "",
        "shopify_id": "0",
        "renew": 0,
        "last_update": "2023-06-04 18:38:53",
        "active": 1,
        "store": {
            "id": 1,
            "name": "Magic4ever",
            "location": "",
            "url": "http:\/\/www.magic4ever.cl\/",
            "active": 1
        }
    }
]

Buscar nombres en ScryFall

requires authentication

Example request:

curl -X GET \
    -G "/v1/card/autocomplete" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "/v1/card/autocomplete"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->get(
    '/v1/card/autocomplete',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (200):

{
    "object": "catalog",
    "total_values": 0,
    "data": []
}

Request      

GET v1/card/autocomplete

Listado de cartas

requires authentication

Este endpoint permite buscar cartas asociadas a un token en scry.cl

Example request:

curl -X GET \
    -G "/v1/card?name=Aberrant&active=1&external_id=5&per_page=10" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "/v1/card"
);

let params = {
    "name": "Aberrant",
    "active": "1",
    "external_id": "5",
    "per_page": "10",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->get(
    '/v1/card',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'query' => [
            'name'=> 'Aberrant',
            'active'=> '1',
            'external_id'=> '5',
            'per_page'=> '10',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

GET v1/card

Query Parameters

name  string optional  
filtrar por nombre.

active  string optional  
filtrar por acitivo.

external_id  string optional  
filtrar por id externo

per_page  string optional  
resultados por paginas

Obtener una carta

Este endpoint permite obtener una carta de una tienda por su id

requires authentication

Example request:

curl -X GET \
    -G "/v1/card/10" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "/v1/card/10"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->get(
    '/v1/card/10',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

GET v1/card/{id}

URL Parameters

id  string optional  
Identificador de la carta a obtener.

Crear una carta

requires authentication

Example request:

curl -X POST \
    "/v1/card" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"asperiores","description":"laborum","edition":"numquam","price":1146.236731,"stock":169849.882196,"image":"eveniet","link":"adipisci","link_edition":"tempora"}'
const url = new URL(
    "/v1/card"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "asperiores",
    "description": "laborum",
    "edition": "numquam",
    "price": 1146.236731,
    "stock": 169849.882196,
    "image": "eveniet",
    "link": "adipisci",
    "link_edition": "tempora"
}

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->post(
    '/v1/card',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'asperiores',
            'description' => 'laborum',
            'edition' => 'numquam',
            'price' => 1146.236731,
            'stock' => 169849.882196,
            'image' => 'eveniet',
            'link' => 'adipisci',
            'link_edition' => 'tempora',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

POST v1/card

Body Parameters

name  string optional  
El nombre de la carta.

description  string optional  
La descripcion de la carta.

edition  string optional  
Edicion de la carta.

price  number optional  
Precio de la carta.

stock  number optional  
Cantidad de cartas disponibles.

image  string optional  
Url de la Imagen de la carta.

link  string optional  
Url de la carta.

link_edition  string optional  
Url de la edicion de la carta.

Actualizar una carta

Actualiza una carta de la tienda, algunos valores requeridos pueden ir vacios.

requires authentication

Example request:

curl -X PUT \
    "/v1/card/totam" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"aut","description":"voluptates","edition":"modi","price":1501.541,"stock":1.477171295,"image":"aliquid","link":"occaecati","link_edition":"iste"}'
const url = new URL(
    "/v1/card/totam"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "aut",
    "description": "voluptates",
    "edition": "modi",
    "price": 1501.541,
    "stock": 1.477171295,
    "image": "aliquid",
    "link": "occaecati",
    "link_edition": "iste"
}

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->put(
    '/v1/card/totam',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'aut',
            'description' => 'voluptates',
            'edition' => 'modi',
            'price' => 1501.541,
            'stock' => 1.477171295,
            'image' => 'aliquid',
            'link' => 'occaecati',
            'link_edition' => 'iste',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

PUT v1/card/{id}

URL Parameters

id  string  

Body Parameters

name  string  
El nombre de la carta.

description  string  
La descripcion de la carta.

edition  string  
Edicion de la carta.

price  number  
Precio de la carta.

stock  number  
Cantidad de cartas disponibles.

image  string  
Url de la Imagen de la carta.

link  string  
Url de la carta.

link_edition  required optional  
string Url de la edicion de la carta.

Eliminar una carta

Este endpoint permite eliminar una carta con su id

requires authentication

Example request:

curl -X DELETE \
    "/v1/card/20" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json"
const url = new URL(
    "/v1/card/20"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->delete(
    '/v1/card/20',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

DELETE v1/card/{id}

URL Parameters

id  string optional  
Identificador de la carta a eliminar.

Actualizar Tienda

Actualiza la tienda asociada al token.

requires authentication

Example request:

curl -X PUT \
    "/v1/store" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{"name":"omnis","location":"et","url":"enim"}'
const url = new URL(
    "/v1/store"
);

let headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "name": "omnis",
    "location": "et",
    "url": "enim"
}

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

$client = new \GuzzleHttp\Client();
$response = $client->put(
    '/v1/store',
    [
        'headers' => [
            'Accept' => 'application/json',
        ],
        'json' => [
            'name' => 'omnis',
            'location' => 'et',
            'url' => 'enim',
        ],
    ]
);
$body = $response->getBody();
print_r(json_decode((string) $body));

Example response (401):

{
    "error": "API Key missing"
}

Request      

PUT v1/store

Body Parameters

name  string  
El nombre de la tienda.

location  string optional  
La ubicación de la tienda.

url  string optional  
La URL de la tienda.