I am trying to access Person or Group column using REST API, but it is giving an error "BAD URL". Can someone please help me with this ?
_api/web/lists/getByTitle('Plan')/getitems?$select=WRNo
Here WRNo is a person or group column name.
You can get it per item:
_api/web/lists/getByTitle('Plan')/items(<id of item>)?$select=WRNo/Title&$expand=WRNo/Id
or all:
_api/web/lists/getByTitle('Plan')/items?$select=WRNo/Title&$expand=WRNo/Id
You need to expand People or Group column to get the details associated with that column.
Get all items
https://site-url/_api/web/Lists/GetByTitle('listname')/Items?$expand=WRNo&$select= WRNo/Title
Get specific item
https://site-url/_api/web/Lists/GetByTitle('listname')/Items(ItemID)?$expand=WRNo&$select= WRNo/Title
Where WRNo is the Person column Internal name.
Below are some available values other than Title to get from Person column with REST :
Title
Name
MobilePhone
SipAddress
Department
JobTitle
FirstName
LastName
WorkPhone
UserName
Office
ID
Modified
Created
ImnName
NameWithPicture
NameWithPictureAndDetails
ContentTypeDisp
I hope this helps.
you should use it like this
http://yourSite/_api/web/lists/getByTitle('Pages')/items?$select=Title,Id,Author/Title&$expand=Author
use expand to select people ou lookup fields