Jump to content

Recommended Posts

Oh no I can build the API - Im just curious how you guys might suggest I do the "global unique ID" like they have.

 

I was thinking like a master and central object table that then through PHP would reference to a page, event, photo, etc table. Was hoping you guys might have some better ways of doing it.

 

:)

Link to comment
https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1350972
Share on other sites

I already did, in your other thread on the topic. 

 

To reiterate: use a RESTful API architecture, where the URI identifies the resource:

 

www.domain.com/user/1 = User #1

www.domain.com/image/1 = Image #1

 

There's no ambiguity in that.  URIs were designed to represent resources, why reinvent the wheel when the current solution is so simple?

Link to comment
https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351001
Share on other sites

It sucks because:

 

1. It adds unnecessary overhead both on INSERT and on SELECT,

2. It circumvents a useful, elegant, meaningful HTTP architecture to unnecessarily abstract "objects".

3. It introduces API interface ambiguity,

4. It requires use of a BIGINT unique id for all "objects", and

5. It adds a lot of work to developing your API

 

All the above, and doesn't offer a single quantifiable advantage.

 

Just cause FB does it doesn't mean it's right.  They're trying to design an API that idiots can use... not exactly the best premise for good design.

Link to comment
https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351006
Share on other sites

That's my point in interface ambiguity. 

 

Not knowing what you're asking for is a BAD thing in application development.

 

Let's say I ask for all photos for facebook.com/12345 - great... that may work for all their "objects". 

 

But what happens when I ask for "first_name" and 12345 turns out to be an event?  Events don't HAVE a first_name

 

Point is, if you use an explicit HTTP interface, the uri defines what TYPE of object you're asking for AS WELL AS its identity.

 

So I can say www.yourdomain.com/user/12345 and KNOW what I can do with that resource.

 

I have nothing else to add to this discussion.  If I haven't convinced you yet, I wish you the best of luck in your career.

Link to comment
https://forums.phpfreaks.com/topic/263589-graph-objects/#findComment-1351009
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.