Exemple json folosite in mesaje API

Pentru mesajele de mai jos am folosit interogari directe curl din bash dar acestea se pot integra in mod similar si cu schimbari minime si in php.
Mesaj interogare lista gestiuni:

api_key="$(echo 123456789123456789: | base64)"
ip=192.168.1.1
port=12345
curl -X POST --header "Authorization: Basic $api_key" --header \
"Content-Type: application/json" --header "charset=UTF-8" http://$ip:$port/api/v1/read/gestiuni -d "{}"

La un mesaj de acest fel vom primi un raspuns ca cel de mai jos:

{"isError":false,"message":"OK","result":"[{\"id_intern\":\"1(1)\",\"id_extern\":\"0\",\"nume\":\"Demo\",\"gestionar\":\"Demo\",\"adresa\":\"\",\"id_centru_profit\":\"3(1)\",\"id_partener\":\"0(0)\",\"id_adresa\":\"0(0)\",\"met_desc\":\"La sold        \",\"cont_cash\":\"                 \",\"cont_card\":\"                 \",\"cont_tic\":\"                 \",\"cont_cec\":\"                 \",\"aninactiv\":2019,\"id_salariat\":\"0(0)\",\"valoric\":false,\"data_creare\":\"2007-11-02T10:53:24.653\",\"user_creare\":\"admin\",\"data_modificare\":\"2019-09-14T14:26:29.510\",\"user_modificare\":\"admin\"},{\"id_intern\":\"2(1)\",\"id_extern\":\"0\",\"nume\":\"Demo\",\"gestionar\":\"Demo\",\"adresa\":\"Demo\",\"id_centru_profit\":\"1(1)\",\"id_partener\":\"5785(1)\",\"id_adresa\":\"13(1)\",\"met_desc\":\"La sold        \",\"cont_cash\":\"5311.01.  .  .   \",\"cont_card\":\"5125.01.  .  .   \",\"cont_tic\":\"5328.  .  .  .   \",\"cont_cec\":\"                 \",\"aninactiv\":0,\"id_salariat\":\"1(1)\",\"valoric\":false,\"data_creare\":\"2007-11-02T10:57:14.437\",\"user_creare\":\"admin\",\"data_modificare\":\"2019-06-21T17:57:52.217\",\"user_modificare\":\"admin\"}]"}

Mesaj adaugare comanda client:

#!/bin/bash
#Am salvat credentialele intr-un fisier separat pentru a putea lucra mai usor si le incarcam mai jos.
source api.key
#Convertim cheia concatenata semnul doua puncte intr-o variabila.
api_key="$(echo $cheie: | base64)"
#Rulam interogarea folosind pentru parametri continutul unui fisier.
curl -X POST --header "Authorization: Basic $api_key" --header "Content-Type: \
application/json" --header "charset=UTF-8" \
http://$ip:$port/api/v1/import/comenzi_clienti -d @import_comenzi_clienti.json

Continutul fisierului import_comenzi_clienti.json

{
    "parametri": {

        "id_extern_comanda": null,
        "keep_data_on_err": false,
        "single_tran": true,
        "id_linie_document1": null


    },
    "antete": [{
        "id_document": "111111114",
        "tip_document": "Comanda client",
        "id_carnet": 23,
        "data_document": "2019-10-7 13:00",
        "data_valabil": null,
        "data_livrare": null,
        "scadenta": null,
        "moneda": "RON",
        "id_gestiune": "1(1)",
        "den_gestiune": "Market 1",
        "id_client": "2",
        "cif_client": "",
        "den_client": "",
        "id_gestiune_in": "",
        "den_gestiune_in": "",
        "id_agent": "",
        "den_agent": "",
        "id_pregatire": "",
        "den_pregatire": "",
        "id_adresa": "",
        "den_adresa": "",
        "id_ruta": "",
        "den_ruta": "",
        "id_program": "",
        "den_program": "",
        "id_cursa": "",
        "den_cursa": "",
        "rezervare": "0",
        "aprobare": "1",
        "taxare_inversa": "0",
        "factura_cu_tva": "0",
        "validare": "1",
        "observatii": "Modalitate de plata+ Avans,",
        "discount": "0.0000",
        "discount_proc": "0.00",
        "valoare": "0.0000",
        "linii": [{
            "id_document": "111111114",
            "id_linie_document": "",
            "id_produs": "",
            "cod_produs": "5941132300024",
            "den_produs": "",
            "tip_produs": "",
            "cont_produs": "",
            "serie_produs": "",
            "cantitate": "10.000",
            "pret_furnizor": "0.0000",
            "pret_vanzare": "5.0000",
            "discount": "0.0000",
            "discount_proc": "0.00",
            "denumire_sup": ""
        }]
    }]
}

La acest mesaj un raspuns gol - ca cel de mai jos - indica un import cu succes:

{"isError":false,"message":"OK","result":"[]"}

results matching ""

    No results matching ""