When asking your question, please include:
The steps you have taken
Relevant screenshots
Any links you have
[ Code { "and": "JSON", "in" : "code block"} ]
Exclude Personal Information.
Hello,
I am a bit confused on how to send a Http post so I would appreciate if someone could help me.
The API documentation says for required variable:
Name Type Validation
emisor array Required
tipodoc string Required
servicio integer Required
and I have an documentatio example using PHP and Guzzle HTTP:
$data = [
‘emisor’ =>
[
‘tipodoc’ => ‘39’,
‘servicio’ => 3,
],
‘detalles’ =>
[
[
‘codigo’ => ‘10001’,
‘nombre’ => ‘Pan’,
‘cantidad’ => 1,
‘precio’ => 500,
‘exento’ => false,
],
],
‘expects’ => ‘all’,
];
$client = new GuzzleHttp\Client;
$response = $client->post(‘Lioren Enterprises’, [
‘headers’ => [
‘Accept’ => ‘application/json’,
‘Authorization’ => 'Bearer '.$accessToken,
‘Content-Type’ => ‘application/json’
],
‘body’ => json_encode($data),
]);
$responseBody = json_decode((string) $response->getBody(), true);
I have tried different configurations and I get a Status code 200 but with an error that says “emisor must be an array” (I believe an array).
Any idea how to fix it?
Best regards