D
D
Denis2016-06-06 12:09:29
PHP
Denis, 2016-06-06 12:09:29

What API output format should be used?

There is an API and a developer conflict.
From the usermeta table, the API outputs a response in the format

object(stdClass)[165]
  public 'data' => 
    array (size=2)
      0 => 
        object(stdClass)[167]
          public 'type' => string 'meta' (length=4)
          public 'id' => string '31' (length=2)
          public 'attributes' => 
            object(stdClass)[168]
              public 'key' => string 'social_id' (length=8)
              public 'value' => string '123' (length=3)
              public 'user_id' => int 2
              public 'site_id' => int 2
          public 'links' => 
            object(stdClass)[169]
              public 'self' => string 'https://example.com//metas/31' (length=29)

It is difficult for one group to work with such data, because to get a simple value -> key, you need to look for it also in the answer. Another group suggests using the format
object(stdClass)[165]
  public 'meta' => 
    object(stdClass)[167]
      public 'social_id' => 
        object(stdClass)[168]
          public 'id' => int 31
          public 'value' => int 123
          public 'user_id' => int 2
          public 'links' => string 'https://example.com//metas/31' (length=29)

But everything rests on jsonapi.org, but also working with ordinary data, like getting 1 value, turns into dancing around the standard. Perhaps both sides are wrong and a different format should be used to get that answer?
Or is someone still right?
The table has the structure id, user_id, site_id, key, value

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question