question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Mapping example

See original GitHub issue

I’m following API mapping document to map my api with ng-admin but I’m not success. My API wrap all data inside data value and send back with meta like this: image

Here is my code

RestangularProvider.addElementTransformer('users', function(element) {

            for (var key in element.data) {
                element[key] = element.data[key];
            }
            return element;
        });

In console log it shows

Error: Response for getList SHOULD be an array and not an object or something else

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Xenniscommented, Feb 1, 2015

My configuration:

RestangularProvider.addResponseInterceptor(function(data, operation, what, url, response) {
    if (operation == "getList") {
        data = data.items;
    }
    return data;
});

In my case the data array is in an items field instead of a data field, like in your case.

0reactions
thangngoc89commented, Feb 2, 2015

@fzaninotto sorry. It’s my bad. I’m using ng-admin 0.4.0. Updated to master and everything are fine now

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Gateway mapping template and access logging variable ...
Reference for variables and functions used in mapping templates, access logging, etc.
Read more >
Working with API mappings for REST APIs - 亚马逊云科技
An API mapping specifies an API, a stage, and optionally a path to use for the mapping. For example, you can map the...
Read more >
Understanding API Gateway Payload Mappings
API Gateway allows you to define input mapping templates, for mapping the incoming request from a client to a server format, and output...
Read more >
AWS API Gateway: Mapping Template Cheatsheet
A reference for common Integration Request mapping template variables.
Read more >
Mapping Templates in API Gateways - 6 - YouTube
aws # api -gateway #awscommunity In this video, we will learn how to use mapping templates in API gateway Integration Request to change ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found