Crear una nueva cuenta bancaria de un cliente.
POST https://api.appsat.net/v1/ClientesCuentasBancarias/
curl "https://api.appsat.net/v1/ClientesCuentasBancarias/" \
-X POST \
-d "[\n {\n \"empresa_id\": 1,\n \"sucursal_id\": 1,\n \"cliente_id\": 5751,\n \"cliente_cuenta_bancaria_iban\": \"ES1700000000000000000\",\n \"cliente_cuenta_bancaria_swift_bic\": \"BBBB/CCCCC\",\n \"cliente_cuenta_bancaria_titular\": \"Titular\",\n \"cliente_cuenta_bancaria_entidad\": \"Banco\",\n \"cliente_cuenta_bancaria_principal\": \"1\",\n \"cliente_cuenta_bancaria_fecha_add\": \"2019-06-27 11:52:55\",\n \"cliente_cuenta_bancaria_fecha_upd\": \"2020-09-19 13:41:40\",\n \"cliente_cuenta_bancaria_delete\": 0,\n \"cliente_cuenta_bancaria_custom_id\": \"\"\n }\n]" \
-H "accept: */*" \
-H "key: " \
-H "Content-Type: application/json"
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(e) {
var response = e.target.responseText;
console.log(response);
});
xhr.addEventListener('error', function(e) {
console.error('Request errored with status', e.target.status);
});
xhr.open('POST', 'https://api.appsat.net/v1/ClientesCuentasBancarias/');
xhr.setRequestHeader('accept','*/*');
xhr.setRequestHeader('key','');
xhr.setRequestHeader('Content-Type','application/json');
var body = '';
body += '[\n';
body += ' {\n';
body += ' "empresa_id": 1,\n';
body += ' "sucursal_id": 1,\n';
body += ' "cliente_id": 5751,\n';
body += ' "cliente_cuenta_bancaria_iban": "ES1700000000000000000",\n';
body += ' "cliente_cuenta_bancaria_swift_bic": "BBBB/CCCCC",\n';
body += ' "cliente_cuenta_bancaria_titular": "Titular",\n';
body += ' "cliente_cuenta_bancaria_entidad": "Banco",\n';
body += ' "cliente_cuenta_bancaria_principal": "1",\n';
body += ' "cliente_cuenta_bancaria_fecha_add": "2019-06-27 11:52:55",\n';
body += ' "cliente_cuenta_bancaria_fecha_upd": "2020-09-19 13:41:40",\n';
body += ' "cliente_cuenta_bancaria_delete": 0,\n';
body += ' "cliente_cuenta_bancaria_custom_id": ""\n';
body += ' }\n';
body += ']';
xhr.send(body);
import requests
url = 'https://api.appsat.net/v1/ClientesCuentasBancarias/'
headers = {'accept': '*/*','key': '','Content-Type': 'application/json'}
body = """[
{
"empresa_id": 1,
"sucursal_id": 1,
"cliente_id": 5751,
"cliente_cuenta_bancaria_iban": "ES1700000000000000000",
"cliente_cuenta_bancaria_swift_bic": "BBBB/CCCCC",
"cliente_cuenta_bancaria_titular": "Titular",
"cliente_cuenta_bancaria_entidad": "Banco",
"cliente_cuenta_bancaria_principal": "1",
"cliente_cuenta_bancaria_fecha_add": "2019-06-27 11:52:55",
"cliente_cuenta_bancaria_fecha_upd": "2020-09-19 13:41:40",
"cliente_cuenta_bancaria_delete": 0,
"cliente_cuenta_bancaria_custom_id": ""
}
]"""
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "https://api.appsat.net/v1/ClientesCuentasBancarias/");
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
/* if redirected, tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: */*");
headers = curl_slist_append(headers, "key: ");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
char *body ="[ { \"empresa_id\": 1, \"sucursal_id\": 1, \"cliente_id\": 5751, \"cliente_cuenta_bancaria_iban\": \"ES1700000000000000000\", \"cliente_cuenta_bancaria_swift_bic\": \"BBBB/CCCCC\", \"cliente_cuenta_bancaria_titular\": \"Titular\", \"cliente_cuenta_bancaria_entidad\": \"Banco\", \"cliente_cuenta_bancaria_principal\": \"1\", \"cliente_cuenta_bancaria_fecha_add\": \"2019-06-27 11:52:55\", \"cliente_cuenta_bancaria_fecha_upd\": \"2020-09-19 13:41:40\", \"cliente_cuenta_bancaria_delete\": 0, \"cliente_cuenta_bancaria_custom_id\": \"\" }]";
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
}
/* Clean up after yourself */
curl_easy_cleanup(curl);
return 0;
}
/* See: http://stackoverflow.com/a/2329792/1127848 of how to read data from the response. */
URL url = new URL("https://api.appsat.net/v1/ClientesCuentasBancarias/");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("accept", "*/*");
con.setRequestProperty("key", "");
con.setRequestProperty("Content-Type", "application/json");
/* Payload support */
con.setDoOutput(true);
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes("[\n");
out.writeBytes(" {\n");
out.writeBytes(" \"empresa_id\": 1,\n");
out.writeBytes(" \"sucursal_id\": 1,\n");
out.writeBytes(" \"cliente_id\": 5751,\n");
out.writeBytes(" \"cliente_cuenta_bancaria_iban\": \"ES1700000000000000000\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_swift_bic\": \"BBBB/CCCCC\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_titular\": \"Titular\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_entidad\": \"Banco\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_principal\": \"1\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_fecha_add\": \"2019-06-27 11:52:55\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_fecha_upd\": \"2020-09-19 13:41:40\",\n");
out.writeBytes(" \"cliente_cuenta_bancaria_delete\": 0,\n");
out.writeBytes(" \"cliente_cuenta_bancaria_custom_id\": \"\"\n");
out.writeBytes(" }\n");
out.writeBytes("]");
out.flush();
out.close();
int status = con.getResponseCode();
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer content = new StringBuffer();
while((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
in.close();
con.disconnect();
System.out.println("Response status: " + status);
System.out.println(content.toString());
[{
"status": "1",
"cliente_id": 5751,
"cliente_cuenta_bancaria_id": 19996,
"info": "Creado"
}]
[{
"status": "0",
"info": "Motivo del error."
}]
BODY PARAMS
empresa_id integer (requerido)sucursal_id integer (requerido)
cliente_id integer (requerido)
cliente_cuenta_bancaria_iban string
cliente_cuenta_bancaria_swift_bic string
cliente_cuenta_bancaria_titular string
cliente_cuenta_bancaria_entidad string
cliente_cuenta_bancaria_principal string
(Opciones: 0 = alternativa | 1 = cuenta de facturación)
cliente_cuenta_bancaria_fecha_add datetime
cliente_cuenta_bancaria_fecha_upd datetime
cliente_cuenta_bancaria_delete integer
(Opciones: 0 = visible | 1 = eliminado)
cliente_cuenta_bancaria_custom_id string