Introducción
Para aprovechar todos los beneficios que la API te ofrece, así como para una correcta funcionalidad de la misma, es necesario contar con ciertos requisitos, los cuales son indispensables para realizar solicitudes y respuestas en cualquier punto de venta, aplicaciones móviles o cualquier otro sistema.
Para poder tener acceso a la API y a sus funcionalidades es necesario:
- Estar registrado como proveedor
- Contar con equipo técnico: programadores, desarrolladores con conocimientos técnicos.
Autenticación
Las credenciales de autenticación son utilizadas para acreditación de todas las llamadas al servidor por medio de la autenticación basada en Bearer token.
Para autenticar las solicitudes, incluya un encabezado Authorization con el valor "Bearer {YOUR_AUTH_KEY}".
Genera tu token
POST Login
Se requiere solicitar integración a un representante para poder generar un token valido y vigente.
Example request:
curl --request POST \
"https://api.expercom.mx/v1/login" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"email\": \"[email protected]\",
\"password\": \"^81fas\"
}"
const url = new URL(
"https://api.expercom.mx/v1/login"
);
const headers = {
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"email": "[email protected]",
"password": "^81fas"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.expercom.mx/v1/login',
[
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'email' => '[email protected]',
'password' => '^81fas',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://api.expercom.mx/v1/login'
payload = {
"email": "[email protected]",
"password": "^81fas"
}
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Orden de compra
Servicio para la petición o consulta de pedido.
POST Solicitar Pedido
requires authentication
Servicio para la petición de solicitud de un pedido, para la solicitud de pedido es necesario consultar previamente la existencia y precios de los productos con el apoyo de los servicios de productos.
Example request:
curl --request POST \
"https://api.expercom.mx/v1/order" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"warehouse_id\": 44,
\"rfc\": \"magnam\",
\"number_order\": \"consequatur\",
\"shipping\": {
\"contact_name\": \"consequatur\",
\"phone\": \"odit\",
\"street\": \"illum\",
\"num_ext\": \"quas\",
\"num_int\": \"sequi\",
\"neighborhood\": \"animi\",
\"city\": \"voluptas\",
\"state\": \"vel\",
\"zipcode\": \"esse\"
},
\"products\": [
{
\"product_id\": \"culpa\",
\"qty\": 2210659.086953,
\"price\": 0.883746
}
]
}"
const url = new URL(
"https://api.expercom.mx/v1/order"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"warehouse_id": 44,
"rfc": "magnam",
"number_order": "consequatur",
"shipping": {
"contact_name": "consequatur",
"phone": "odit",
"street": "illum",
"num_ext": "quas",
"num_int": "sequi",
"neighborhood": "animi",
"city": "voluptas",
"state": "vel",
"zipcode": "esse"
},
"products": [
{
"product_id": "culpa",
"qty": 2210659.086953,
"price": 0.883746
}
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.expercom.mx/v1/order',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'warehouse_id' => 44.0,
'rfc' => 'magnam',
'number_order' => 'consequatur',
'shipping' => [
'contact_name' => 'consequatur',
'phone' => 'odit',
'street' => 'illum',
'num_ext' => 'quas',
'num_int' => 'sequi',
'neighborhood' => 'animi',
'city' => 'voluptas',
'state' => 'vel',
'zipcode' => 'esse',
],
'products' => [
[
'product_id' => 'culpa',
'qty' => 2210659.086953,
'price' => 0.883746,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://api.expercom.mx/v1/order'
payload = {
"warehouse_id": 44,
"rfc": "magnam",
"number_order": "consequatur",
"shipping": {
"contact_name": "consequatur",
"phone": "odit",
"street": "illum",
"num_ext": "quas",
"num_int": "sequi",
"neighborhood": "animi",
"city": "voluptas",
"state": "vel",
"zipcode": "esse"
},
"products": [
{
"product_id": "culpa",
"qty": 2210659.086953,
"price": 0.883746
}
]
}
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
Productos
Servicios de consulta de información de productos.
GET Productos
requires authentication
Listado completo de productos para la verificacion de existencia y precio.
Example request:
curl --request GET \
--get "https://api.expercom.mx/v1/products" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.expercom.mx/v1/products"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.expercom.mx/v1/products',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://api.expercom.mx/v1/products'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.
GET Producto
requires authentication
Obtener el detalle de un producto
Example request:
curl --request GET \
--get "https://api.expercom.mx/v1/product/6" \
--header "Authorization: Bearer {YOUR_AUTH_KEY}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"const url = new URL(
"https://api.expercom.mx/v1/product/6"
);
const headers = {
"Authorization": "Bearer {YOUR_AUTH_KEY}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());$client = new \GuzzleHttp\Client();
$response = $client->get(
'https://api.expercom.mx/v1/product/6',
[
'headers' => [
'Authorization' => 'Bearer {YOUR_AUTH_KEY}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));import requests
import json
url = 'https://api.expercom.mx/v1/product/6'
headers = {
'Authorization': 'Bearer {YOUR_AUTH_KEY}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()Example response (401):
Show headers
cache-control: no-cache, private
content-type: application/json
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Tip: Check that you're properly connected to the network.
If you're a maintainer of ths API, verify that your API is running and you've enabled CORS.
You can check the Dev Tools console for debugging information.