I’ve a small utility that when initialized will get some data from a Sharepoint Listing through REST name.
These data ultimately must be modified from inside the appliance, once more through REST API, and saved in the identical Listing.
That’s the reason, once I initially get these data, I additionally retailer the ListItemEntityTypeFullName worth of the Listing in a worldwide scope variable, that might be later handed within the POST operate.
My code to get the listing objects is as follows:
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/internet/lists/getbytitle('" + listName + "')/objects",
sort: "GET",
headers: {"Settle for": "utility/json;odata=verbose"}
}).executed(operate(knowledge) {
listType = knowledge.d.outcomes[0].__metadata.sort
});
If no aspect is discovered, the one method I do know to retailer the ListItemEntityTypeFullName worth could be to make a second ajax name because it follows:
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/_api/internet/lists/getbytitle('" + listName + "')/?$choose=ListItemEntityTypeFullName",
sort: "GET",
headers: {"Settle for": "utility/json;odata=verbose"}
}).executed(operate(knowledge) {
listType = knowledge.d.ListItemEntityTypeFullName
});
Now, my query is: is there any method to make each requests in a single name, in order that if no parts have been discovered within the Listing, I can nonetheless get someplace the ListItemEntityTypeFullName worth? I’m making an attempt to optimize the variety of calls I’ve to make to maintain the appliance quick and clean.
Thanks!