Actualizar Familia

Actualizar una familia especifica.

PUT https://api.appsat.net/v1/Familias/id/

curl "https://api.appsat.net/v1/Familias/id/" \
  -X PUT \
  -d "[{\"empresa_id\":1,\"sucursal_id\":1,\"parent_id\":0,\"text\":\"Mecanismos\",\"familia_fecha_add\":\"2020-03-13 09:37:46\",\"familia_fecha_upd\":\"2020-03-13 09:37:46\",\"familia_delete\":0}]" \
  -H "key: "
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('PUT', 'https://api.appsat.net/v1/Familias/id/');
xhr.setRequestHeader('key','');
var body = '';
body += '[{"empresa_id":1,"sucursal_id":1,"parent_id":0,"text":"Mecanismos","familia_fecha_add":"2020-03-13 09:37:46","familia_fecha_upd":"2020-03-13 09:37:46","familia_delete":0}]';
xhr.send(body);
import requests

url = 'https://api.appsat.net/v1/Familias/id/'
headers = {'key': ''}
body = """[{"empresa_id":1,"sucursal_id":1,"parent_id":0,"text":"Mecanismos","familia_fecha_add":"2020-03-13 09:37:46","familia_fecha_upd":"2020-03-13 09:37:46","familia_delete":0}]"""

req = requests.put(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/Familias/id/");
	curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
	/* if redirected, tell libcurl to follow redirection */
	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

	struct curl_slist *headers = NULL;
	headers = curl_slist_append(headers, "key: ");
	curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);

	char *body ="[{\"empresa_id\":1,\"sucursal_id\":1,\"parent_id\":0,\"text\":\"Mecanismos\",\"familia_fecha_add\":\"2020-03-13 09:37:46\",\"familia_fecha_upd\":\"2020-03-13 09:37:46\",\"familia_delete\":0}]";
	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/Familias/id/");
HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
con.setRequestMethod("PUT");
con.setRequestProperty("key", "");

/* Payload support */
con.setDoOutput(true);
DataOutputStream out = new DataOutputStream(con.getOutputStream());
out.writeBytes("[{\"empresa_id\":1,\"sucursal_id\":1,\"parent_id\":0,\"text\":\"Mecanismos\",\"familia_fecha_add\":\"2020-03-13 09:37:46\",\"familia_fecha_upd\":\"2020-03-13 09:37:46\",\"familia_delete\":0}]");
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",
  "id": 14,
  "info": "Actualizado"
}]
[{
  "status": "0",
  "info": "Motivo del error."
}]

BODY PARAMS

empresa_id // integer (requerido)
sucursal_id // integer (requerido)
parent_id // integer
text // String
familia_fecha_add // YYYY-MM-DD H:i:s
familia_fecha_upd // YYYY-MM-DD H:i:s
familia_delete // integer
(Opciones: 0 = visible | 1 = eliminado)