0

I am stuck with the arrival of an API.

Anyone have any idea how could I do this?

{
"lang": "fr_FR",
"scope": "open",
"returnCode": 200,
"shipment": {
"idShip": "XXXXXXXXXXXXX",
"holder": 4,
"product": "colissimo",
"isFinal": true,
"deliveryDate": "2020-07-22T11:23:00+02:00",
"entryDate": "2020-07-21T01:08:01+02:00",
"timeline": [
{ "shortLabel": "Votre colis est pris en charge", "longLabel": "", "id": 1, "date": "2020-07-21T01:08:01+02:00", "country": "", "status": true, "type": 1 },
{ "shortLabel": "Il est en traitement dans notre r\u00e9seau.", "longLabel": "", "id": 2, "country": "", "status": true, "type": 1 },
{ "shortLabel": "Votre colis est arriv\u00e9 sur son site de livraison.", "longLabel": "", "id": 3, "country": "", "status": true, "type": 1 },
{ "shortLabel": "Nous pr\u00e9parons votre colis pour sa livraison.", "longLabel": "", "id": 4, "country": "", "status": true, "type": 1 },
{ "shortLabel": "Votre colis a \u00e9t\u00e9 livr\u00e9", "longLabel": "", "id": 5, "date": "2020-07-22T11:23:00+02:00", "country": "", "status": true, "type": 1 }
],
"event": [
{ "order": 100, "label": "Votre colis est livr\u00e9.", "date": "2020-07-22T11:23:00+02:00", "code": "DI1" },
{ "order": 99, "label": "Votre colis est dans le site de livraison qui dessert votre adresse. Nous le pr\u00e9parons pour le mettre en livraison.", "date": "2020-07-22T06:45:04+02:00", "code": "MD2" },
{ "order": 98, "label": "Votre colis est en transit sur nos plateformes logistiques pour vous \u00eatre livr\u00e9 le plus rapidement possible.", "date": "2020-07-21T01:08:01+02:00", "code": "ET1" },
{ "order": 97, "label": "Votre Colissimo va bient\u00f4t nous \u00eatre confi\u00e9 ! Il est en cours de pr\u00e9paration chez votre exp\u00e9diteur.", "date": "2020-07-20T15:39:48+02:00", "code": "DR1" }
],
"contextData": { "deliveryChoice": { "deliveryChoice": 0 }, "originCountry": "FR", "arrivalCountry": "FR" },
"url": "https://www.laposte.fr/outils/suivre-vos-envois?code=XXXXXXXXXXXXX"
}
}

// timeline : shortLabel can be false if there is no data ex : { "shortLabel": "", "longLabel": "", "id": 5, "country": "", "status": false, "type": 1 }

// event : order can have 96,95,94,93 so the table will have to be dynamic

Kalius
  • 1
  • you can use json_decode to convert json to an array or object, then you can retrieve any data from it – GNassro Jul 25 '20 at 08:03
  • If you try something and still have problems, ask with more specific code and what isn't working as you need it to. – Nigel Ren Jul 25 '20 at 08:06

0 Answers0