1

I am trying to get last modified Sub-Sites from sharepoint site using Sharepoint rest api and executing rest calls using Java

I am using below url:

https://XXXXX.sharepoint.com/sites/XXXX-Test-SharePoint/_api/web/WebInfos?$select=Configuration,Id,Created,Language,LastItemUserModifiedDate,ServerRelativeUrl,WebTemplate,WebTemplateId,LastItemModifiedDate,Title&$filter=LastItemModifiedDate gt datetime'2017-06-05T05:21:56Z' and LastItemModifiedDate le datetime'2017-06-05T10:21:56Z'

Request Headers are as below :

"Cookie":getCookieValue(sharepointRequest.getCookies())));
"Accept":"application/json";
"Content-Encoding:gzip";
"User-Agent":"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)";
"Content-Type":"application/json;odata=verbose;charset=utf-8";

But when i execute above url,it is saying Bad Request so I have printed response headers:

Header-Key :null            Header-Value[HTTP/1.1 400 Bad Request]
Header-Key :Date            Header-Value[Mon, 05 Jun 2017 10:22:08 GMT]
Header-Key :Content-Length  Header-Value[311]
Header-Key :Connection      Header-Value[close]
Header-Key :Content-Type    Header-Value[text/html; charset=us-ascii]
Header-Key :Server          Header-Value[Microsoft-HTTPAPI/2.0]

Now when i execute same URL with REST postman through browser it is giving me proper result and response header by REST postman client is as below :

Strict-Transport-Security: max-age=31536000
Content-Encoding: gzip
X-Content-Type-Options: nosniff
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Transfer-Encoding: chunked
P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
X-SharePointHealthScore: 0
X-SP-SERVERSTATE: ReadOnly=0
request-id: bf9df89d-e012-3000-bc42-3178c4635d41
MicrosoftSharePointTeamServices: 16.0.0.6525
X-MS-InvokeApp: 1; RequireReadOnly
SPRequestDuration: 71
Last-Modified: Mon, 05 Jun 2017 09:56:22 GMT
Server: Microsoft-IIS/8.5
SPRequestGuid: bf9df89d-e012-3000-bc42-3178c4635d41
X-FRAME-OPTIONS: SAMEORIGIN
Date: Mon, 05 Jun 2017 09:56:23 GMT
Vary: Accept-Encoding
Content-Type :application/json;odata=minimalmetadata;streaming=true;charset=utf-8
Cache-Control: private, max-age=0
SPClientServiceRequestDuration: 34
DATASERVICEVERSION: 3.0
Expires: Sun, 21 May 2017 09:56:22 GMT

I am not able to figure out what is happening

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.