I have a problem with getting the ContentType name for a item.
when i use
http://sp2013dev/sites/mms/_api/web/lists/GetByTitle('List')/items(1)/?$expand=ContentType
I get as response all Fields from the ContentType, which is so far not bad,
but if I use also select
in the query the ContentType Fields are not included in the results it only returns
Result:
ContentType: {
__deferred: {
uri: "http://site/_api/Web/Lists(guid'b911f75b-1988-4f44-bd88-39ab510562a4')/Items(1)/ContentType"
}-
}
Query:
http://site/_api/web/lists/GetByTitle('List')/items(1)/?$select=Id,Title,ContentType&$expand=ContentType
And the second problem is that when I use ?$expand=ContentType/Name
(I only need the name of the ContentType) it is ignored completely and I get all Fields from the ContentType
Edit:
After trying
/_api/web/lists/GetByTitle('')/items()/?$select=Id,FileRef,ContentType/Id,ContentType/Name&$expand=ContentType
as recommend by Vadim i get the following response
{
d: {
__metadata: {
id: "4b62e4e7-a023-4992-b689-e9cf49f3ef86"
uri: "<url>/_api/Web/Lists(guid'b911f75b-1988-4f44-bd88-39ab510562a4')/Items(1)"
etag: ""3""
type: "SP.Data.AgendaElementsUsedListItem"
}
ContentType: {
__deferred: {
uri: "<url>/_api/Web/Lists(guid'b911f75b-1988-4f44-bd88-39ab510562a4')/Items(1)/ContentType"
}
}
Id: 1
ID: 1
FileRef: "/sites/mms/Lists/AgendaElementsUsed/1_.000"
}
}
$select=*&$expand=ContentType
(but doesn't help of course), as well does...Items(1)/ContentType/Description
and.../Items(1)/ContentType?$select=Description
..../Items(1)/ContentType?$select=Description
but then I'am missing some custom fields from the listitem (id,title,...)