Discussions

Ask a Question
ANSWERED

Transform server response to match schema.

Hi Jason, Is there a way to tell js-data to parse a resource response object differently ? Let's say your server respond the following json : ``` { "i": 123, "n": "Alfred" } ``` And you want your resource to be defined as follow : ``` DS.defineResource("person", { schema: { id: "string", name: "string" } }); ``` I know I can do it with a http request/response interceptor in AngularJS, but I would like to do it on the resource level. Any idea ?
ANSWERED

Create nested resources trough parent

Is there a way to create associated records through the parent? Like in rails (http://api.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html)
ANSWERED

Nested endpoint with shared id

I am attempting to use an API that has the following endpoint layout. I'm not sure how to define the resources in js-data to match it. GET /api/buildings Returns an array of buildings GET /api/buildings/90 Returns an object containing a summary from the specified building GET /api/buildings/90/info Returns an object containing detailed information from the specified building PUT /api/building/90/info Update the information of a building The building endpoint and the info endpoint share the same ID. I have two resources defined: Building and BuildingInfo. My first thought was to define a belongsTo relationship in BuildingInfo with parent = true, however this results in js-data generating a url containing the ID twice (/api/building/90/info/90). I suspect js-data does not support this use case currently. I'm hoping to find out how I can do it with minimal changes to js-data.
ANSWERED

json request suffix

How can you set a .json suffix to all requests? Like in restangular: https://github.com/mgonto/restangular#setrequestsuffix
ANSWERED

Customizing HTTP Api

The API of our server is a bit different from your conventions, a typical query will look like this: www.myurl.com/contact.json?$filter=id eq 1 Is writing a completely new adapter the only way to accomplish this, or are there any hooks to customize standard DSHttpAdapter's url parsing? many thx, timm
ANSWERED

IE8 Support

I understand that you don't officially support IE8, but I need to use a subset of the functionality that JS Data provides in a project that is required to support IE8. Do you know if it may be possible to get JS Data working in IE8 with the use of polyfills?