Hi
I am accessing the REST service using esriRequest which is http URL from the portal linked web application.
however the application is accessing using https and response giving unable to load the url status 0.
Please give me solution for this.
Cheers,
Srikanth Dasari
Dasari,
Portal urls are always https so your app that access the portal url should use https.
I am accessing SharePoint REST Service URL (http) from the application https. Do I need to make SharePoint as a secured one??
mixed content is always a bad practice so yes.
Thank you
Even if its a bad practise, Could you please provide the solution??
You would have to share your code for that.
var requestJson = {
method: "POST",
body: { '__metadata': { 'type': 'SP.Data.Data RequestListItem' }, 'Requestor': 'Test' }
//facilities: webMercatorUtils.webMercatorToGeographic(this.geom).x + "," + webMercatorUtils.webMercatorToGeographic(this.geom).y + ";",
////outSR: this.geom.spatialReference.wkid,
//token: this.token.token,
//defaultBreaks: [this.selectBufferUnits.value],
//f: "json"
};esriRequest({
url: "http://sp/ops/Portal/_api/Lists/GetByTitle('ListItem')/items",
content: requestJson,
handleAs: "json",
withCredentials:true
}).then(lang.hitch(this, function (response) {
this._showError(response);
}), function (err) {
new Message({ titleLabel: "Warning", message: err.message });
});
Here is the code and getting the error in the console is below.
init.js:141 GET https://sp/ops/Portal/_api/Lists/GetByTitle('ListItem')/items?method=POST&body=%5Bobject%20Object%5D net::ERR_CONNECTION_TIMED_OUT
l @ init.js:141
b.xhr @ init.js:92
b.xhrGet @ init.js:92
w @ init.js:1010
g @ init.js:1013
A @ init.js:1019
(anonymous) @ init.js:1019
c @ init.js:103
C.then.then @ init.js:105
always @ init.js:112
C @ init.js:1019
_onBtnSubmitClicked @ Widget.js?wab_dv=2.6:102
(anonymous) @ init.js:63
init.js:89 f {message: "Unable to load //sp/ops/Portal/_api/Lists/GetByT…?method=POST&body=%5Bobject%20Object%5D status: 0", response: {…}, status: 0, responseText: "", xhr: XMLHttpRequest, …}
Is the GetByTitle portion of your url a function that you are trying to call?
There is a hierarchy in SharePoint..
Website --> List Items (Forms) --> items (Records)
In order to create a new record in one of the Form -->
https://sp/ops/Portal/_api/Lists/GetByTitle('FormName') --> Will give access to the form-->
https://sp/ops/Portal/_api/Lists/GetByTitle("FormName")/items --> Will give access to the records either to create or query
Cheers,
Srikanth Dasari