Question

my list with external list reference

I have a list and some columns retrieve value from external list. How to get all items from that list(attached img) with REST

I'm trying like this

function traerSolicitudes() {
        var lista = "MetadataTabla";
        var siteUrl = _spPageContextInfo.webAbsoluteUrl;
    var hostweburl = _spPageContextInfo.webAbsoluteUrl;
        +_spPageContextInfo.webServerRelativeUrl;

    var scriptbase = hostweburl + "/_layouts/15/";
    $.getScript(scriptbase + "SP.RequestExecutor.js", ejecutarCrossDomain);
    function ejecutarCrossDomain() {
            var executor = new SP.RequestExecutor(siteUrl);
            var urlRest = siteUrl + "/_api/web/lists/GetByTitle('"
                + lista + "')/items?";
            myList = [];
            traerTodosLosItems();
            function traerTodosLosItems() {
        executor.executeAsync({
                    url: urlRest,
               type: "GET",
               headers: {
                   "accept": "application/json;odata=verbose",
               },
               success: function (data) {
                var jsonObject = JSON.parse(data.body);

                $.each(jsonObject.d.results, function (index, item) {

                  console.log(jsonObject.d.results)
                   });

                   },
                   error: function (error) {

                       alert(JSON.stringify(error));
                   }
               });
            }
        }
    }

Result:

the REST retrieve just field items like datetime, text and number, but not "external data" type, in the console.log external data fields type return NULL

Blockquote

Was it helpful?

Solution

this is the way I retrieve the external content type items. I define all fields i want to retrieve in the select of the rest api

   $select=metadata_tablaID,informacion,valor,tipo_de_dato," +
           "duenho,fecha_de_carga,fecha_de_vigencia,selloID,capituloID,checklistID,frameworkID,grupoID,maestroClasificadorID,nivelID
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top