Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Writing adapter for my API

$
0
0

@mtangoo wrote:

I have an API that does not follow JSONAPI format. Its written in Yii2 and so it have a consistent format. Here is an example:

api/v1/companies

[
  {
    "id": 1,
    "name": "Company 1",
    "contact": "P.O. Box 1234 MZA", 
    "create_time": 1234,
    "update_time": 1234
  },
  {
    "id": 2,
    "name": "Company 2",
    "contact": "P.O. Box 5678 DSM", 
    "create_time": 1234,
    "update_time": 1234
  }
]

and getting single model

api/vi1/companies/1

{
    "id": 2,
    "name": "Company 2",
    "contact": "P.O. Box 5678 DSM", 
    "create_time": 1234,
    "update_time": 1234
  }

I need now to configure the right adapter to help me handle my requests (that is just single endpoint only). Looking at documentation I have three choices. JSONAPI seems to be a wrong choice in my case and am confused with the two as to which one I should use and how to do it.

My Ember app sits in different domain (hence URL) from the API domain. I would appreciate also any link that explains something near to my use case.

Its my first time to try out Ember-data so if it sound as a fool's question, please bear with me! Thanks a lot!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles