Join two SharePoint 2013 lists using operator

Isaac
Isaac used Ask the Experts™
on
I have two SharePoint lists. 1) Posts and 2) Categories

The Posts list has a lookup field called 'Category' into the Categories list.

I am trying to use the $expand option to join the two lists but I'm unsuccessful.  I'm trying to follow the example used in this site but I'm confused.

Any ideas?

I've tried the following and many other combinations but I get errors
http://understandsp.com/blog/_api/web/lists/getbytitle('Posts')/items/?&select=Title,Category/Id&$expand=Title/Id

Here's where you can look at my lists
http://understandsp.com/blog/_layouts/15/start.aspx#/_layouts/15/viewlsts.aspx

Please help!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Rajendra ShekhawatSolution Architect

Commented:
Hi,

I have used following REST Query to get the data related to lookup.

Posts - Parent List
Posts has Category Lookup Column - Display Column 'Title'

Please try below query -

origin + "/_api/web/lists/getbytitle('Posts')/items?$select=Title, Category/Title&$expand=Category/Title

Let me know, in case of any issues.

Cheers,
Raj
IsaacSharePoint Client Side Developer

Author

Commented:
That did not work.
http://understandsp.com/blog/_api/web/lists/getbytitle('Posts')/items/?&select=Title,Category/Title&$expand=Category/Title
When using a blog site, it's really different. If you have access to a blog site, try it for your self. Post and Categories are created by default.
Rajendra ShekhawatSolution Architect

Commented:
Hi,

As you said lists in your question, i missed blog.

Field Name of Category in blog is PostCategory .

I have tried below query on blog and works fine, gives me list of categories.

Try this -

http://c4968397007/sites/blog/_api/web/lists/getbytitle('Posts')/items?$select=Title,PostCategory/Title&$expand=PostCategory/Title

Cheers,
Raj
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Solution Architect
Commented:
Hi,

Did it work ?

Cheers,
Raj
IsaacSharePoint Client Side Developer

Author

Commented:
That worked! Thank you very much.  I've been dealing with this for days.
IsaacSharePoint Client Side Developer

Author

Commented:
Rajendra Shekhawat,

Can you please assist with this question? Thanks!
http://www.experts-exchange.com/questions/28735845/REST-api-postCatgory-showing-as-object.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial