Interface ZzzSxcWebApiDeprecated
Deprecated Old APIs on sxc.webApi. They only exist if jQuery is included on the page, and we highly discourage their use.
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Package: Api.Js.SxcJs
Methods
delete(string | ZzzAjaxSettingsDeprecated, any, any, boolean)
Deprecated Please use fetchJson() or fetchJson() instead. Returns an http-delete promise using jQuery
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Declaration
function delete(settingsOrUrl: string | ZzzAjaxSettingsDeprecated, params?: any, data?: any, preventAutoFail?: boolean)
Parameters
Type | Name | Description |
---|---|---|
string | ZzzAjaxSettingsDeprecated | settingsOrUrl |
the url to talk to |
any | params |
jQuery style ajax parameters |
any | data |
jQuery style data for post/put requests |
boolean | preventAutoFail |
Returns
Type | Description |
---|---|
any | jQuery ajax promise object |
get(string | ZzzAjaxSettingsDeprecated, any, any, boolean)
Deprecated Please use fetchJson() or fetchJson() instead. Returns an http-get promise using jQuery
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Declaration
function get(settingsOrUrl: string | ZzzAjaxSettingsDeprecated, params?: any, data?: any, preventAutoFail?: boolean)
Parameters
Type | Name | Description |
---|---|---|
string | ZzzAjaxSettingsDeprecated | settingsOrUrl |
the url to get |
any | params |
jQuery style ajax parameters |
any | data |
jQuery style data for post/put requests |
boolean | preventAutoFail |
Returns
Type | Description |
---|---|
any | jQuery ajax promise object |
post(string | ZzzAjaxSettingsDeprecated, any, any, boolean)
Deprecated Please use fetchJson() or fetchJson() instead. Returns an http-post promise using jQuery
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Declaration
function post(settingsOrUrl: string | ZzzAjaxSettingsDeprecated, params?: any, data?: any, preventAutoFail?: boolean)
Parameters
Type | Name | Description |
---|---|---|
string | ZzzAjaxSettingsDeprecated | settingsOrUrl |
the url to get |
any | params |
jQuery style ajax parameters |
any | data |
jQuery style data for post/put requests |
boolean | preventAutoFail |
Returns
Type | Description |
---|---|
any | jQuery ajax promise object |
put(string | ZzzAjaxSettingsDeprecated, any, any, boolean)
Deprecated Please use fetchJson() or fetchJson() instead. Returns an http-put promise using jQuery
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Declaration
function put(settingsOrUrl: string | ZzzAjaxSettingsDeprecated, params?: any, data?: any, preventAutoFail?: boolean)
Parameters
Type | Name | Description |
---|---|---|
string | ZzzAjaxSettingsDeprecated | settingsOrUrl |
the url to put |
any | params |
jQuery style ajax parameters |
any | data |
jQuery style data for post/put requests |
boolean | preventAutoFail |
Returns
Type | Description |
---|---|
any | jQuery ajax promise object |
request(string | ZzzAjaxSettingsDeprecated, any, any, boolean, string)
Deprecated Please use fetchJson() or fetchJson() instead. Generic http request using jQuery
Deprecated sxc.webApi Helpers using JQuery
2sxc originally used jQuery and the JS API still has commands which do jQuery AJAX calls. On the webApi
object they are
webApi.delete(...)
for HTTP DELETE callswebApi.get(...)
for HTTP GET callswebApi.post(...)
for HTTP POST callswebApi.put(...)
for HTTP PUT callswebApi.request(...)
for any other HTTP calls
Warning
As of 2sxc 12.10 we don't recommend using this any more.
It will only work if the page also has jQuery enabled either using
pageService.Activate("jQuery");
(see IPageService)
or because something else like the theme/skin already loads it.
From now on we strongly suggest you use fetch
which is supported by all modern browsers.
See webApi.fetch
Tip
To find out how to get the module sxc-object using $2sxc, check out SxcWebApi
Example
Here's a simple example (assuming you have the $2sxc manager):
<a onclick="$2sxc(this).webApi.get('app/auto/data/Category').then(handleResult);">
get all Categories
</a>
The code above shows
- how the sxc-object is retrieved using the
$2sxc(...)
manager, based on the current contextthis
- how all items of type "Category" are requested
- how the result (promise) is passed on to
handleResults
for updating the view etc.
Here's another quick example, calling a C# web-api endpoint:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm")
.success(function(result) {
// ....
});
Working with REST / HTTP Async Stuff
Short note: these WebAPIs work using jQuery promises (not JavaScript promises), supporting .then(...)
, .error(...)
etc.
The $2sxc(...).webApi has 4 jQuery commands
.webApi.get(url, ...)
.webApi.post(url, ...)
.webApi.delete(url, ...)
.webApi.put(url, ...)
Each of these has the following parameters
url
orsettings
required string|object: a Url for the end-point OR a{ ... }
settings objectparams
optional object: the url params like{ id: 27, name: "hello" }
data
optional object: the data - in case of post / put, like{ ... }
preventAutoFail
optional bool: if true, won't automatically show a default message on error, so that you can handle errors differently
Quick examples:
var sxc = $2sxc(27);
sxc.webApi.post("Form/ProcessForm", {}, data, true)
.success(function() {
// ....
})
.error(function() {
// ...
});
This will call the C# WebApi controller FormController
in the api
folder and go for its ProcessForm
command. It will use no url-params, but put a data
object in the body (as json), and will do error-handling itself.
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/query/[queryname]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/query/
Working with Custom C# App WebAPIs
In short:
- use
$2sxc(...).webApi.get(...)
or$2sxc(...).webApi.post(...)
etc. - for the path-parameter, use a path starting with
app/auto/api/[controller]/[action]
- 2sxc will take care of all the path resolutions if the path starts withapp/auto/api/
You can read more about the C# WebApi Server Side
Short note: the WebAPIs work like classic javascript promises. So not like the data.on(event) implementation which is a bit special, this is very standard jQuery promise.
Demo App and further links
You should find some code examples in this demo App
- TimeLineJS
- all the JS-apps including AngularJS in the app-catalog
More links: Description of the feature on 2sxc docs
Declaration
function request(settings: string | ZzzAjaxSettingsDeprecated, params: any, data: any, preventAutoFail: boolean, method: string)
Parameters
Type | Name | Description |
---|---|---|
string | ZzzAjaxSettingsDeprecated | settings | |
any | params |
jQuery style ajax parameters |
any | data |
jQuery style data for post/put requests |
boolean | preventAutoFail | |
string | method |
the http verb name |
Returns
Type | Description |
---|---|
any | jQuery ajax promise object |