Support

Account

Home Forums Backend Issues (wp-admin) How to load Post Type fields with data from a remote API Reply To: How to load Post Type fields with data from a remote API

  • I need to load the post Type with the data from the external URL, which brings a json with the data (fist code Sample of remote url(json))

    My data is:

    Comarca > Unidade > Setor

    I need tó load a data from json URL to be selected in the Backend

    `
    {
    “id”: 1,
    “nome”: “Tribunal de Justiça do Estado do Acre”,
    “sigla”: “TJAC”,
    “comarcas”: [{
    “id”: 2,
    “nome”: “Acrelândia”,
    “sigla”: “AL”,
    “unidades”: [{
    “id”: 24,
    “nome”: “Direção do Foro”,
    “sigla”: “ALDFO”,
    “setor”: [{
    “id”: 28,
    “nome”: “Vara Cível”,
    “sigla”: “ACVCI”,
    “tipo”: “VARA”
    },
    {
    “id”: 30,
    “nome”: “Vara Criminal”,
    “sigla”: “ACVCR”,
    “tipo”: “VIRTUAL”
    }

    ],
    “tipo”: “ADMINISTRATIVA”,
    ]
    }
    [{

    “id”: 2,
    “nome”: “Rio Branco”,
    “sigla”: “RB”,
    “unidades”: [{
    “id”: 24,
    “nome”: “Direção do Foro”,
    “sigla”: “ALDFO”,
    “setor”: [{
    “id”: 28,
    “nome”: “Central de Execução de Penas e Medidas Alternativas”,
    “sigla”: “BRCEPAL”,
    “tipo”: “VARA”
    },
    {
    “id”: 30,
    “nome”: “Juizado Especial Criminal”,
    “sigla”: “BRJECRIM”,
    “tipo”: “VIRTUAL”
    }

    ],
    “tipo”: “ADMINISTRATIVA”

    }]
    }]
    }
    }
    `

    Field “sertor” => receive [nome] after selecting [comarca] and [unidade]
    Field “sigla” => receive [sigla]

    I’m researching an implementation model that makes this possible.