dojox/rpc/JsonRest (version 1.10)

See the dojox/rpc/JsonRest reference documentation for more information.

Property Summary

Method Summary

  • _loader(callback)
  • byId(service,id)
  • changing(object,_deleting) adds an object to the list of dirty objects.
  • commit(kwArgs) Saves the dirty data using REST Ajax methods
  • deleteObject(object) deletes an object
  • fetch(absoluteId) Fetches a resource by an absolute path/id and returns a dojo.Deferred.
  • getConstructor(service,schema) Creates or gets a constructor for objects from this service
  • getDirtyObjects()
  • getIdAttribute(service) Return the ids attribute used by this service (based on it's schema).
  • getServiceAndId(absoluteId) Returns the REST service and the local id for the given absolute id.
  • isDirty(item,store) returns true if the item is marked as dirty or true if there are any dirty items
  • query(service,id,args)
  • registerService(service,servicePath,schema) Registers a service for as a JsonRest service, mapping it to a path and schema
  • revert(service) Reverts all the changes made to JSON/REST data
  • sendToServer(actions,kwArgs)
  • serviceClass(path,isJson,schema,getRequest) This provides a HTTP REST service with full range REST verbs include PUT,POST, and DELETE.

Properties

_saveNotNeeded
conflictDateHeader
Defined by: dojox/rpc/JsonRest
schemas
Defined by: dojox/rpc/JsonRest
services
Defined by: dojox/rpc/JsonRest

Methods

_loader(callback)
Defined by dojox/rpc/JsonRest
Parameter Type Description
callback undefined
byId(service,id)
Defined by dojox/rpc/JsonRest
Parameter Type Description
service undefined
id undefined
Returns:instance | undefined
changing(object,_deleting)
Defined by dojox/rpc/JsonRest

adds an object to the list of dirty objects. This object contains a reference to the object itself as well as a cloned and trimmed version of old object for use with revert.

Parameter Type Description
object undefined
_deleting undefined
commit(kwArgs)
Defined by dojox/rpc/JsonRest

Saves the dirty data using REST Ajax methods

Parameter Type Description
kwArgs undefined
Returns:Array
deleteObject(object)
Defined by dojox/rpc/JsonRest

deletes an object

Parameter Type Description
object undefined

object to delete

fetch(absoluteId)
Defined by dojox/rpc/JsonRest

Fetches a resource by an absolute path/id and returns a dojo.Deferred.

Parameter Type Description
absoluteId undefined
Returns:undefined
getConstructor(service,schema)
Defined by dojox/rpc/JsonRest

Creates or gets a constructor for objects from this service

Parameter Type Description
service Function | String
schema undefined
Returns:undefined
getDirtyObjects()
Defined by dojox/rpc/JsonRest
Returns:Array
getIdAttribute(service)
Defined by dojox/rpc/JsonRest

Return the ids attribute used by this service (based on it's schema). Defaults to "id", if not other id is defined

Parameter Type Description
service undefined
Returns:string
getServiceAndId(absoluteId)
Defined by dojox/rpc/JsonRest

Returns the REST service and the local id for the given absolute id. The result is returned as an object with a service property and an id property

Parameter Type Description
absoluteId String

This is the absolute id of the object

Returns:object
isDirty(item,store)
Defined by dojox/rpc/JsonRest

returns true if the item is marked as dirty or true if there are any dirty items

Parameter Type Description
item undefined
store undefined
Returns:undefined
query(service,id,args)
Defined by dojox/rpc/JsonRest
Parameter Type Description
service undefined
id undefined
args undefined
Returns:undefined
registerService(service,servicePath,schema)
Defined by dojox/rpc/JsonRest

Registers a service for as a JsonRest service, mapping it to a path and schema

Parameter Type Description
service Function

This is the service to register

servicePath String

This is the path that is used for all the ids for the objects returned by service

schema Object
Optional

This is a JSON Schema object to associate with objects returned by this service

revert(service)
Defined by dojox/rpc/JsonRest

Reverts all the changes made to JSON/REST data

Parameter Type Description
service undefined
sendToServer(actions,kwArgs)
Defined by dojox/rpc/JsonRest
Parameter Type Description
actions undefined
kwArgs undefined
serviceClass(path,isJson,schema,getRequest)
Defined by dojox/rpc/JsonRest

This provides a HTTP REST service with full range REST verbs include PUT,POST, and DELETE.

A normal GET query is done by using the service directly:

var restService = dojox.rpc.Rest("Project");
restService("4");

This will do a GET for the URL "/Project/4".

restService.put("4","new content");

This will do a PUT to the URL "/Project/4" with the content of "new content".

You can also use the SMD service to generate a REST service:

var services = dojox.rpc.Service({services: {myRestService: {transport: "REST",...
services.myRestService("parameters");

The modifying methods can be called as sub-methods of the rest service method like:

services.myRestService.put("parameters","data to put in resource");
services.myRestService.post("parameters","data to post to the resource");
services.myRestService['delete']("parameters");
Parameter Type Description
path String
isJson Boolean
Optional
schema Object
Optional
getRequest Function
Optional
Returns:function
Error in the documentation? Can’t find what you are looking for? Let us know!