Hello,

I'm trying to get the content of a sharepoint list. The list has 145 elements but when I tes my request with outsystems, I got no item...

so if I test with the REST Method:

https://testsp.sharepoint.com/sites/Collaboration/MD/_api/web/lists/GetByTitle('OEM_Short_ID')

I get:

{
  "d": {
    "__metadata": {
      "id": "https://testsp.sharepoint.com/sites/Collaboration/MD/_api/Web/Lists(guid'501be800-c650-4549-9a05-85ac2c08d131')",
      "uri": "https://testsp.sharepoint.com/sites/Collaboration/MD/_api/Web/Lists(guid'501be800-c650-4549-9a05-85ac2c08d131')",
      "etag": "\"81\"",
      "type": "SP.List"
    },
...
    "Items": {
      "__deferred": {
        "uri": "https://testsp.sharepoint.com/sites/Collaboration/MD/_api/Web/Lists(guid'501be800-c650-4549-9a05-85ac2c08d131')/Items"
      }
    },
...
    "AllowContentTypes": true,
    "BaseTemplate": 100,
    "BaseType": 0,
    "ContentTypesEnabled": false,
    "CrawlNonDefaultViews": false,
    "Created": "2018-04-10T13:33:46Z",
    "CurrentChangeToken": {
      "__metadata": {
        "type": "SP.ChangeToken"
      },
      "StringValue": "1;3;501be800-c650-4549-9a05-85ac2c08d131;636887794655170000;303275688"
    },
    "DefaultContentApprovalWorkflowId": "00000000-0000-0000-0000-000000000000",
    "DefaultItemOpenUseListSetting": false,
    "Description": "",
    "Direction": "none",
    "DisableGridEditing": false,
    "DocumentTemplateUrl": null,
    "DraftVersionVisibility": 0,
    "EnableAttachments": true,
    "EnableFolderCreation": false,
    "EnableMinorVersions": false,
    "EnableModeration": false,
    "EnableRequestSignOff": true,
    "EnableVersioning": true,
    "EntityTypeName": "OEM_x005f_Short_x005f_IDList",
    "ExemptFromBlockDownloadOfNonViewableFiles": false,
    "FileSavePostProcessingEnabled": false,
    "ForceCheckout": false,
    "HasExternalDataSource": false,
    "Hidden": false,
    "Id": "501be800-c650-4549-9a05-85ac2c08d131",
    ...
    "ItemCount": 145,
    ...
    "Title": "OEM_Short_ID"
  }
}

as you can see, the value of ItemCount is 145

but the method:

https://testsp.sharepoint.com/sites/Collaboration/MD/_api/web/lists/GetByTitle('OEM_Short_ID')/Items

returns:

{  "d": {    "results": []  }}

For info, if I type this URL in my browser I get all 145 items

Do you know why?

Can someone help me?

Thanks in advance

Vincent

Hi,

CrossCheck your Response Structure.

Based on your browser response the high-level structure for JSON is:

{

"d":{

   "_metadata":{

      }

  }

}


But If you see what you mention for Outsystem Output is not same.

Goto the Consume REST API Interface & Test it once again & Copy the Response Structure from TEST-Response to Body-Response.

The issue is of the Structure. You can also debug the API Call on Browser.

Run you App on Browser & Goto Inspect-Network

This way you can debug the Response you are getting from API

Thanks

Assif

Hi Vincent ,

Did you check service center logs ? Check if you can see any error there. Also match your structure with the response and see if the attributes are  properly mapped .


Regards,

-PJ-


I think Assif is right here, your Structure probably doesn't match the output. Also, if you want to check whether you receive the data at all, see this post.

Thanks for all your answers!!

I not a specialist of REST and json...

to explain, I have these results with the Test function of the REST API interface and I didn't create any structure for the response yet...

So this is the result I have in the Response field of the REST API Interface.

I will try to check all your advice to see if I have forgotten something

Hi,

You do not need to create the Response Structure for the JSON.

OutSystem will Automatically create the REST API Request & Response Structure based on what you provided in Body

Note: 

-Make sure to copy the Success Response Structure only in Body instead of any error or False Response

-Consume API with the Request params which response with successful data.

Ref Documentation to learn more about REST API Consume:

https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/REST/Consume_REST_APIs/Consume_a_REST_API


Thanks,

Assif