Sucursales
2 min
A partir de esta especificación se podrán crear sucursales de un subcomercio o entidad dentro de la plataforma, siempre y cuando esté habilitado dicho módulo.
Crear o Editar Sucursal
POST
https://{suga-id}.sugaway.io/p/branch
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- x-suga-entitystringrequiredDescription
Body Parameters
- namestringrequiredDescription
- referencestringDescription
- addressObjectrequiredDescription
- streetstringrequiredDescription
- numberstringrequiredDescription
- floorstringDescription
- flatstringDescription
- notesstringDescription
- statestringrequiredDescription
- citystringrequiredDescription
- zipCodestringrequiredDescription
- emailstringDescription
- phonestringDescription
- accountTypestringDescription
- accountNumberstringDescription
curl
curl --location --globoff 'https://{suga-id}.sugaway.com/p/branch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"name":"string","reference":"string","address":"Object","state":"string","city":"string","zipCode":"string","email":"string","phone":"string"}'nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://{suga-id}.sugaway.com/p/branch',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://{suga-id}.sugaway.com/p/branch", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
import json
url = "https://{suga-id}.sugaway.com/p/branch"
payload = json.dumps({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "json"
require "net/http"
url = URI("https://{suga-id}.sugaway.com/p/branch")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
response = https.request(request)
puts response.read_body
200
{
"id": "BranchID",
}404
{
"message": "Ain't no cake like that."
}En caso de no utilizar referencia, es posible utilizar el siguiente método para editar una sucursal:
Editar Sucursal
PUT
https://{suga-id}.sugaway.io/p/branch/{branch-id}
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- x-suga-entitystringrequiredDescription
Body Parameters
- namestringDescription
- addressObjectDescription
- streetstringrequiredDescription
- numberstringrequiredDescription
- floorstringDescription
- flatstringDescription
- notesstringDescription
- statestringDescription
- citystringDescription
- zipCodestringDescription
- emailstringDescription
- phonestringDescription
- accountTypestringDescription
- accountNumberstringDescription
curl
curl --location --globoff 'https://{suga-id}.sugaway.com/p/branch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"name":"string","reference":"string","address":"Object","state":"string","city":"string","zipCode":"string","email":"string","phone":"string"}'nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://{suga-id}.sugaway.com/p/branch',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://{suga-id}.sugaway.com/p/branch", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
import json
url = "https://{suga-id}.sugaway.com/p/branch"
payload = json.dumps({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "json"
require "net/http"
url = URI("https://{suga-id}.sugaway.com/p/branch")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
"name": "string",
"reference": "string",
"address": "Object",
"state": "string",
"city": "string",
"zipCode": "string",
"email": "string",
"phone": "string"
})
response = https.request(request)
puts response.read_body
200
{
"id": "BranchID",
}404
{
"message": "Ain't no cake like that."
}Los posibles códigos de error al crear o modificar una sucursal son:
- BRANCH:INVALID_REFERENCE
- ENTITY:COUNTRY_INVALID_STATE
- ENTITY:INVALID_MCC
- ENTITY:INVALID_ZIP_CODE
- ENTITY:INVALID_ADDRESS
- ENTITY:INVALID_ACCOUNT
- NDFE -> El {branch-id} enviado no corresponde a una sucursal válida
Inactivar Sucursal
PUT
https://{suga-id}.sugaway.io/p/branch/:id/inactive
Path Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- x-suga-entitystringrequiredDescription
curl
curl --location --globoff --request PUT 'https://{suga-id}.sugaway.io/p/branch/:id/inactive/{id}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'nodejs
var request = require('request');
var options = {
'method': 'PUT',
'url': 'https://{suga-id}.sugaway.io/p/branch/:id/inactive/{id}',
'headers': {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var requestOptions = {
method: 'PUT',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://{suga-id}.sugaway.io/p/branch/:id/inactive/{id}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
import json
url = "https://{suga-id}.sugaway.io/p/branch/:id/inactive/{id}"
payload = {}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "json"
require "net/http"
url = URI("https://{suga-id}.sugaway.io/p/branch/:id/inactive/{id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Accept"] = "application/json"
request["Content-Type"] = "application/json"
response = https.request(request)
puts response.read_body
200
{
"name": "Cake's name",
}404
{
"message": "Ain't no cake like that."
}Reactivar Sucursal
PUT
https://{suga-id}.sugaway.io/p/branch/:id/active
Path Parameters
- idstringrequiredDescription
Header Parameters
- x-api-keystringrequiredDescription
- x-access-tokenstringrequiredDescription
- x-suga-entitystringrequiredDescription
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"id": "string"
});
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.cakes.com", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));200
{
"name": "Cake's name",
}404
{
"message": "Ain't no cake like that."
}