Understanding URIs, Tokens, and CFC Resources

36 views
Skip to first unread message

Phillip Duba

unread,
May 20, 2013, 12:55:50 PM5/20/13
to taffy...@googlegroups.com
So I'm not sure if I'm following this correctly or getting confused by my OO definitions and Web Service setups previously done. Let's say I have two entities in my domain model, Employees and Departments. For our app we need essentially 5 type of "get" services:

GetDeptartments
GetDeptDetails
GetDeptEmplolyees
GetEmployees
GetEmployeeDetails

Now, using the Member/Collection breakdown, I'd have the following breakdown, I think:

DepartmentCollection --> GetDepartments
DepartmentMember --> GetDeptDetails
EmployeeCollection --> GetEmployees
EmployeeMember --> GetEmployeeDetails

The one I'm confused with would be the GetDeptEmployees. I'm thinking of a parameter on the EmployeeCollection to get back the employees in a department by passing the department id as a URL parameter. Also, if one was to provide a "search" REST service, what would be the best way to do that? A combination of a get service on one of the collections above plus parameters? Thanks,

Phil

Adam Tuttle

unread,
May 20, 2013, 1:02:57 PM5/20/13
to taffy...@googlegroups.com
Hey Phil,

Great question. Your first guesses for 4/5 services are dead on for how I would personally implement them.

For the 5th I would do an additional resource CFC named DeptEmployeeCollection, with a URI of "/depts/{deptId}/employees"

So your URIs would be:

/depts
/depts/{deptId}
/depts/{deptId}/employees
/employees
/employees/{emplId}

...With naming that makes sense for you, of course. These are just examples.

HTH,
Adam


Phillip Duba wrote:
--
You received this message because you are subscribed to the Google
Groups "Taffy Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to taffy-users...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Phillip Duba

unread,
May 20, 2013, 1:09:50 PM5/20/13
to taffy...@googlegroups.com
Ah, ok. That makes sense but leads me to another question. So unlike when setting up services or other type of objects, is it somewhat ok practice to have multiple CFCs in the resources folder that reflect around the same (or related) entities? Thanks,

Phil

--
You received this message because you are subscribed to a topic in the Google Groups "Taffy Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/taffy-users/ppYyXD9UaYA/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to taffy-users...@googlegroups.com.

Adam Tuttle

unread,
May 20, 2013, 2:25:07 PM5/20/13
to taffy...@googlegroups.com
Absolutely. Where with services you tend to try and group them based on the entity that they affect, with *Taffy* you split based on what makes the most sense for URIs. Just think of your URIs first and everything else flows from that. :)

Adam

Phillip Duba wrote:

    For more options, visit https://groups.google.com/groups/opt_out.


    --
    You received this message because you are subscribed to a topic in
    the Google Groups "Taffy Users" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/taffy-users/ppYyXD9UaYA/unsubscribe?hl=en.
    To unsubscribe from this group and all its topics, send an email
    to taffy-users...@googlegroups.com

Phillip Duba

unread,
May 20, 2013, 2:31:43 PM5/20/13
to taffy...@googlegroups.com
Gotcha. Thanks again, just a slight change of thinking. I'll have more questions as I dive into "securing" the APIs,

Phil

To unsubscribe from this group and all its topics, send an email to taffy-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages