mardi 27 février 2018

Parsing data from RESTful api pokeapi.com

I'm new to Ember and I'm have another BIG(problem) question. I am trying to show the details of each pokemon based on the REST API https://pokeapi.co, the details of each pokemon are in https://pokeapi.co/api/v2/pokemon/pokemon_name/, (example: https://pokeapi.co/api/v2/pokemon/bulbasaur/)

This Twiddle have all my code

i dont know how to serialize it and show the data of each pokemon in monster-detail.hbs

The details example: https://pokeapi.co/api/v2/pokemon/bulbasaur

abilities<- Need this data
    0:
       slot: 3
       is_hidden: true
       ability:
        url: "https://pokeapi.co/api/v2/ability/34/"
        name: "chlorophyll" <- Need this data
    1:  
       slot: 1
       is_hidden: false
       ability: 
         url: "https://pokeapi.co/api/v2/ability/65/"
         name: "overgrow"  <- Need this data
stats: <- Need this data
    0:  
       stat:
        url: "https://pokeapi.co/api/v2/stat/6/"
        name: "speed" <- Need this data
        effort: 0
        base_stat: 45 <- Need this data
    1:  
       stat:    
        url: "https://pokeapi.co/api/v2/stat/5/"
        name: "special-defense" <- Need this data
        effort: 0
        base_stat: 65 <- Need this data
    2:  
       stat:
        url: "https://pokeapi.co/api/v2/stat/4/"
        name: "special-attack" <- Need this data
        effort: 1
        base_stat: 65 <- Need this data
    3:  
       stat:    
        url: "https://pokeapi.co/api/v2/stat/3/"
        name: "defense" <- Need this data
        effort: 0
        base_stat: 49 <- Need this data
    4:  
       stat:    
        url: "https://pokeapi.co/api/v2/stat/2/"
        name: "attack"<- Need this data
        effort: 0
        base_stat: 49 <- Need this data
    5:
       stat:
        url: "https://pokeapi.co/api/v2/stat/1/"
        name: "hp" <- Need this data
        effort: 0
        base_stat: 45 <- Need this data
name: "bulbasaur" <- Need this data
weight: 69 <- Need this data
height: 7 <- Need this data
id: 1 <-Don't need
base_experience: 64 <- Need this data




Aucun commentaire:

Enregistrer un commentaire