Repository navigation
ShareCoffee.REST.reqwest
reqwest is a small but powerful lib for executing requests. It has nearly no footprint, which makes it one of my fav. libraries available here on github. ShareCoffee can also provide pre-configured objects for executing REST queries using reqwest!
ShareCoffee is offering both, interaction with the AppWeb and interactions with the HostWeb. If you pass a HostWebUrl to any for.reqwest() call, ShareCoffee will create a configuration-object which allows HostWeb-Access.
Each of the following methods is configured by a single parameter of type ShareCoffee.REST.RequestProperties. You can either create a new instance by using the constructor
ShareCoffee.REST.RequestProperties() or you can pass a JSON object with corresponding properties.
/// Create property-object by using the constructor
var properties = new ShareCoffee.REST.RequestProperties(url, payload, hostWebUrl, eTag, onSuccess, onError);
/// Create a property-object by using JSON syntax
var properties2 = { url: 'web/title')description: TODO
reqwest(ShareCoffee.REST.build.read.for.reqwest({url:"web/lists/?$select=Title,Id", onSuccess: onListsLoaded, onError: onError}));description: TODO
var payload = {
'__metadata': { 'type': 'SP.List' },
'AllowContentTypes': true,
'BaseTemplate': 100,
'ContentTypesEnabled': true,
'Description': 'My list created by REST',
'Title': "Thorstens List"
};
reqwest(ShareCoffee.REST.build.create.for.reqwest({url: "web/lists/",
onSuccess: onListCreated,
onError: onError,
payload: payload}));description: TODO
var payload = {
'__metadata': { 'type': 'SP.List' },
'Title': 'CHANGED BY REST - Thorstens list'
};
reqwest(ShareCoffee.REST.build.update.for.reqwest({ url: "web/lists('" + customListId + "')",
onSuccess: onListUpdated,
onError: onError
payload: payload})); description: TODO
reqwest(ShareCoffee.REST.build.delete.for.reqwest({url: "web/lists('" + customListId + "')",
onSuccess: onListDeleted,
onError: onError}));