Parcourir résultat GET API [Résolu]

Signaler
Messages postés
5
Date d'inscription
dimanche 30 juin 2019
Statut
Membre
Dernière intervention
26 mai 2020
-
Messages postés
5
Date d'inscription
dimanche 30 juin 2019
Statut
Membre
Dernière intervention
26 mai 2020
-
Bonjour,

Je souhaite intégrer dans un site web des annonces immobilières récupérées à l'aide d'une requête GET sur une API.

Je n'arrive pas à trouver le code php qui permet de parcourir le résultat de cette requête afin d'afficher les informations de chaque bien immobilier.

Si jamais quelqu'un pouvait m'aider ce serait vraiment gentil car cela fait des heures que je teste plein de choses différentes sans succès.


Le résultat que j'ai est celui-ci :

{
    "page": 1,
    "pages": 1,
    "total": 18,
    "limit": 100,
    "results": [
        {
            "uuid": "26cb3b6a-481c-4920-9eef-1a88642ec72c",
            "reference": "VENTE_VIAGER-GARAGE",
            "description": "Ma nouvelle description vente-viager-garage",
            "created_at": "2019-11-10T00:20:07+01:00",
            "updated_at": "2019-11-10T00:20:08+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "garage",
                "performance_energetique": {},
                "surface": 40
            },
            "transaction": "vente_viager",
            "prix": 500,
            "type_honoraires": "charge_acquereur",
            "honoraires": 300,
            "bouquet": 250,
            "rente": {
                "montant": 500,
                "periodicite": "semestrielle"
            }
        },
        {
            "uuid": "321c04ce-7dc9-46f1-9332-203c282dc020",
            "reference": "LOCATION-IMMEUBLE",
            "description": "Ma nouvelle description location-immeuble",
            "created_at": "2019-11-10T00:20:05+01:00",
            "updated_at": "2019-11-10T00:20:06+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "immeuble",
                "performance_energetique": {},
                "surface_plancher": 200
            },
            "transaction": "location",
            "loyer": 1000,
            "charges_incluses": true,
            "montant_charges": 2000,
            "meuble": false,
            "montant_depot_garantie": 500
        },
        {
            "uuid": "96740783-5780-4a9f-8e2e-0e0b0d6b0878",
            "reference": "VENTE_TRADITIONNELLE-MAISON",
            "description": "Ma nouvelle description vente-traditionnelle-maison",
            "created_at": "2019-11-10T00:20:03+01:00",
            "updated_at": "2019-11-10T00:20:04+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "maison",
                "performance_energetique": {},
                "surface_habitable": 200
            },
            "transaction": "vente_traditionnelle",
            "prix": 1000,
            "type_honoraires": "charge_acquereur",
            "honoraires": 500
        },
        {
            "uuid": "751097fc-b606-41ac-81e6-e36c9f9d6fc0",
            "reference": "VENTE_TRADITIONNELLE-AUTRE",
            "description": "Ma nouvelle description vente-traditionnelle-autre",
            "created_at": "2019-11-02T00:20:11+01:00",
            "updated_at": "2019-11-02T00:20:12+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "autre",
                "surface": 40
            },
            "transaction": "vente_traditionnelle",
            "prix": 500,
            "type_honoraires": "charge_vendeur",
            "honoraires": 150
        },
        {
            "uuid": "7ba8277b-f233-47db-92b6-43a8c88676c7",
            "reference": "VENTE_VIAGER-AUTRE",
            "description": "Ma nouvelle description vente-viager-autre",
            "created_at": "2019-11-02T00:20:11+01:00",
            "updated_at": "2019-11-02T00:20:12+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [
                    {
                        "uuid": "9dc47baf-957d-4c82-b9d1-74661895271a",
                        "rank": 0
                    }
                ],
                "nature": "autre",
                "surface": 40
            },
            "transaction": "vente_viager",
            "prix": 500,
            "type_honoraires": "charge_vendeur",
            "honoraires": 400,
            "bouquet": 300,
            "rente": {
                "montant": 500,
                "periodicite": "bimensuelle"
            }
        },
        {
            "uuid": "6f4af3e7-75dc-4c67-a3d6-6897a8b1115a",
            "reference": "LOCATION-AUTRE",
            "description": "Ma nouvelle description location-autre",
            "created_at": "2019-11-02T00:20:11+01:00",
            "updated_at": "2019-11-10T00:00:06+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "John",
                "telephone": "01 23 45 67 89",
                "email": "john.doe@test.com"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "autre",
                "surface": 40
            },
            "transaction": "location",
            "loyer": 500,
            "charges_incluses": true,
            "montant_charges": 50,
            "meuble": false,
            "montant_depot_garantie": 150
        },
        {
            "uuid": "a8529211-0376-4c78-9286-a7992ab13190",
            "reference": "VENTE_VIAGER-TERRAIN",
            "description": "Ma nouvelle description vente-viager-terrain",
            "created_at": "2019-11-02T00:20:09+01:00",
            "updated_at": "2019-11-10T00:00:17+01:00",
            "diffused": false,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "terrain",
                "surface": 40
            },
            "transaction": "vente_viager",
            "prix": 500,
            "type_honoraires": "charge_acquereur",
            "honoraires": 300,
            "bouquet": 250,
            "rente": {
                "montant": 500,
                "periodicite": "semestrielle"
            }
        },
        {
            "uuid": "2853fcb4-1a34-4749-82cc-5bccacd396ca",
            "reference": "LOCATION-TERRAIN",
            "description": "Ma nouvelle description location-terrain",
            "created_at": "2019-11-02T00:20:09+01:00",
            "updated_at": "2019-11-10T00:00:05+01:00",
            "diffused": false,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "terrain",
                "surface": 40
            },
            "transaction": "location",
            "loyer": 500,
            "charges_incluses": true,
            "montant_charges": 50,
            "meuble": false,
            "montant_depot_garantie": 150
        },
        {
            "uuid": "4a247d82-24d6-4d90-acb7-ede7e623a833",
            "reference": "VENTE_TRADITIONNELLE-TERRAIN",
            "description": "Ma nouvelle description vente-traditionnelle-terrain",
            "created_at": "2019-11-02T00:20:09+01:00",
            "updated_at": "2019-11-10T00:00:11+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {
                    "access_pmr": true
                },
                "situation_locative": {
                    "occupe": "libre"
                },
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "terrain",
                "surface": 40
            },
            "transaction": "vente_traditionnelle",
            "prix": 500,
            "type_honoraires": "charge_acquereur",
            "honoraires": 150
        },
        {
            "uuid": "7e07a78a-3dc8-4387-9eb7-e4a9082c4b30",
            "reference": "VENTE_TRADITIONNELLE-GARAGE",
            "description": "Ma nouvelle description vente-traditionnelle-garage",
            "created_at": "2019-11-02T00:20:07+01:00",
            "updated_at": "2019-11-10T00:00:10+01:00",
            "diffused": false,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "garage",
                "performance_energetique": {},
                "surface": 20
            },
            "transaction": "vente_traditionnelle",
            "prix": 20,
            "type_honoraires": "charge_vendeur",
            "honoraires": 12
        },
        {
            "uuid": "9300062f-23bc-4821-a161-94bf05c5bb35",
            "reference": "LOCATION-GARAGE",
            "description": "Ma nouvelle description location-garage",
            "created_at": "2019-11-02T00:20:07+01:00",
            "updated_at": "2019-11-10T00:00:04+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [
                    {
                        "uuid": "f51e13f6-73b2-48f4-979e-b3ccd36938d8",
                        "rank": 1
                    },
                    {
                        "uuid": "99ed91c4-c19d-43f8-b782-d5935c95caf2",
                        "rank": 0
                    }
                ],
                "nature": "garage",
                "performance_energetique": {},
                "surface": 20
            },
            "transaction": "location",
            "loyer": 20,
            "charges_incluses": true,
            "montant_charges": 10,
            "meuble": false,
            "montant_depot_garantie": 12
        },
        {
            "uuid": "cf1257af-52db-4a04-859f-eb01a74639d8",
            "reference": "VENTE_VIAGER-IMMEUBLE",
            "description": "Ma nouvelle description vente-viager-immeuble",
            "created_at": "2019-11-02T00:20:05+01:00",
            "updated_at": "2019-11-10T00:00:15+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "immeuble",
                "performance_energetique": {},
                "surface_plancher": 750
            },
            "transaction": "vente_viager",
            "prix": 20,
            "type_honoraires": "charge_vendeur",
            "honoraires": 12,
            "bouquet": 200,
            "rente": {
                "montant": 500,
                "periodicite": "annuelle"
            }
        },
        {
            "uuid": "cf7a25f6-b0b8-4706-b68f-729306dc820f",
            "reference": "VENTE_TRADITIONNELLE-IMMEUBLE",
            "description": "Ma nouvelle description vente-traditionnelle-immeuble",
            "created_at": "2019-11-02T00:20:05+01:00",
            "updated_at": "2019-11-10T00:00:09+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "immeuble",
                "performance_energetique": {},
                "surface_plancher": 200
            },
            "transaction": "vente_traditionnelle",
            "prix": 1000,
            "type_honoraires": "charge_acquereur",
            "honoraires": 500
        },
        {
            "uuid": "4e843566-46e1-4d4c-a4e5-a1d8dddc4da3",
            "reference": "LOCATION-MAISON",
            "description": "Ma nouvelle description location-maison",
            "created_at": "2019-11-02T00:20:03+01:00",
            "updated_at": "2019-11-15T00:00:02+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "maison",
                "performance_energetique": {},
                "surface_habitable": 200
            },
            "transaction": "location",
            "loyer": 1000,
            "charges_incluses": true,
            "montant_charges": 2000,
            "meuble": false,
            "montant_depot_garantie": 500
        },
        {
            "uuid": "ae548aed-81a0-4a6d-aade-06b4831beab8",
            "reference": "VENTE_VIAGER-MAISON",
            "description": "Ma nouvelle description vente-viager-maison",
            "created_at": "2019-11-02T00:20:03+01:00",
            "updated_at": "2019-11-10T00:00:14+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "stationnement": true,
                "exposition": "nord",
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "maison",
                "performance_energetique": {
                    "dpe_value": 230,
                    "dpe_classe": "D",
                    "ges_value": 57,
                    "ges_classe": "F"
                },
                "nb_pieces": 5,
                "nb_chambres": 2,
                "nb_sdb": 1,
                "nb_niveaux": 1,
                "terrasse": true,
                "cuisine": true,
                "piscine": false,
                "surface_habitable": 400,
                "surface_carrez": 250.5
            },
            "transaction": "vente_viager",
            "prix": 100000,
            "type_honoraires": "charge_acquereur",
            "honoraires": 100,
            "bouquet": 500,
            "rente": {
                "montant": 500,
                "periodicite": "trimestrielle"
            }
        },
        {
            "uuid": "efef7922-252f-416d-b42c-916a13b5e0ea",
            "reference": "VENTE_VIAGER-APPARTEMENT",
            "description": "Ma nouvelle description vente-viager-appartement",
            "created_at": "2019-11-02T00:20:01+01:00",
            "updated_at": "2019-11-02T00:20:02+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "appartement",
                "performance_energetique": {},
                "surface_habitable": 70
            },
            "transaction": "vente_viager",
            "prix": 75000,
            "type_honoraires": "charge_acquereur",
            "honoraires": 500,
            "bouquet": 150,
            "rente": {
                "montant": 500,
                "periodicite": "mensuelle"
            }
        },
        {
            "uuid": "20092095-01f4-48f4-aac5-d1c213bad322",
            "reference": "VENTE_TRADITIONNELLE-APPARTEMENT",
            "description": "Ma nouvelle description vente-traditionnelle-appartement",
            "created_at": "2019-11-02T00:20:01+01:00",
            "updated_at": "2019-11-10T00:00:07+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49007",
                    "code_postal": "49000",
                    "libelle": "Angers"
                },
                "photos": [],
                "nature": "appartement",
                "performance_energetique": {},
                "surface_habitable": 70
            },
            "transaction": "vente_traditionnelle",
            "prix": 75000,
            "type_honoraires": "charge_vendeur",
            "honoraires": 500
        },
        {
            "uuid": "01c917bd-8861-4a04-9c1b-8ea4dad5be38",
            "reference": "LOCATION-APPARTEMENT",
            "description": "Cette annonce à été modifié correctement",
            "created_at": "2019-11-02T00:20:01+01:00",
            "updated_at": "2019-11-10T00:00:01+01:00",
            "diffused": true,
            "office": {
                "uuid": "bba80800-0edb-4c32-9385-17c4b8973cca"
            },
            "contact": {
                "nom": "Soqrate"
            },
            "bien": {
                "accessibilite": {},
                "situation_locative": {},
                "commune": {
                    "code_insee": "49323",
                    "code_postal": "49480",
                    "libelle": "Saint sylvain d'anjou"
                },
                "photos": [],
                "nature": "appartement",
                "etat": "neuf",
                "performance_energetique": {},
                "nb_pieces": 7,
                "nb_chambres": 3,
                "nb_sdb": 2,
                "nb_niveaux": 1,
                "balcon": true,
                "cave": false,
                "cuisine": true,
                "piscine": true,
                "surface_habitable": 200.4,
                "surface_carrez": 250
            },
            "transaction": "location",
            "loyer": 750,
            "charges_incluses": true,
            "montant_charges": 100,
            "meuble": false,
            "montant_depot_garantie": 100
        }
    ]
}


EDIT : Ajout des BALISES DE CODE


Merci d'avance,

Bonne journée.

Configuration: Windows / Chrome 83.0.4103.61

2 réponses

Messages postés
29856
Date d'inscription
mercredi 22 octobre 2003
Statut
Modérateur
Dernière intervention
25 octobre 2020
2 878
Bonjour,

Les données sont au format JSON.
Il suffit donc de faire un json_decode puis de le manipuler comme un objet (tu peux même boucler dessus si tu le souhaites, avec un foreach par exemple).
https://www.php.net/manual/fr/function.json-decode.php
Messages postés
5
Date d'inscription
dimanche 30 juin 2019
Statut
Membre
Dernière intervention
26 mai 2020

Bonjour Jordane,

Merci beaucoup pour ton commentaire, j'ai réussi !!

Bonne journée.