/cities
POST https://api.abitmedia.app/settings/v1/cities
Creación de ciudades
Autorizaciones
bearer: {accessToken}
Parámetros Formdata / Atributos objeto JSON
Parametros | Tipo | Requerido | Descripción |
stateId | integer | Si | Id del estado/provincia |
name | string | Si | Nombre de la ciudad |
Ejemplos de código
JavaScript PHP Railsvar xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "https://api.abitmedia.app/settings/v1/cities", false);
// Make sure you set the appropriate headers
xmlHttp.setRequestHeader("Header Key", "Header Value");
var data = "# body is your JSON/ XML/ Text/ Form Query/ etc"
xmlHttp.send(data);
var response = xmlHttp.responseText;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.abitmedia.app/settings/v1/cities");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Make sure you set the nessary headers as a $headers array
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "post")
$body = '';
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
uri = URI.parse("https://api.abitmedia.app/settings/v1/cities")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
# Make sure you set the appropriate headers
request["header"] = "header value"
# body is your JSON/ XML/ Text/ Form Query/ etc
request.set_form_data(body)
response = http.request(request)
Respuesta
200:application/json
{
"success": true,
"status": 200,
"message": "Recurso creado exitosamente",
"data": {
"id": 1,
"stateId": 1,
"name": "Quito",
"createdAt": "2024-01-01 17:50:01",
"updateAt": "2024-01-01 17:50:01"
}
}
"success": true,
"status": 200,
"message": "Recurso creado exitosamente",
"data": {
"id": 1,
"stateId": 1,
"name": "Quito",
"createdAt": "2024-01-01 17:50:01",
"updateAt": "2024-01-01 17:50:01"
}
}
422:
application/json
{
"success": false,
"status": 422,
"message": "Se encontró errores de validación en el recurso enviado",
"data": [
{
"field": "attributo",
"message": "mensaje de error"
}
]
}
"success": false,
"status": 422,
"message": "Se encontró errores de validación en el recurso enviado",
"data": [
{
"field": "attributo",
"message": "mensaje de error"
}
]
}