I need to generate or retrieve report from a SharePoint list using API endpoint. I believe we can request it in JSON by setting the Request headers to "Accept", "application/json; odata=verbose".

Kindly help with the code.

For example for getting the number of Applications submitted successfully or not between a set time period.


1 Answer 1


If you are trying to fetch the SharePoint list items using the SharePoint REST API, you can use the code like below.

Example - JavaScript/JQuery:

<script type="text/javascript" src="/sites/SPConnect/SiteAssets/jquery.min.js"></script>

<button type="button" onclick="getSPListItems()"> Get SharePoint List Items</button>

<script type="text/javascript">
    function getSPListItems() {
        var itemsEndpoint = "https://contoso.sharepoint.com/sites/SPConnect/_api/web/lists/getByTitle('Applications')/items?$select=Title,SubmissionId&$top=5000&$filter=(Created gt datetime'2023-10-01T01:00:00') and (Created lt datetime'2023-10-26T01:00:00')";

            url: itemsEndpoint,
            type: "GET",
            headers: {
                "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                "accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose"
            success: function (data) {
            error: function (error) {


  1. Complete basic operations using SharePoint REST endpoints
  2. Working with lists and list items with REST

Related read:

  1. Filter SharePoint list items based on Created column using SharePoint REST API

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.