Python Consume Sitecore ItemService

The Sitecore ItemService provides a RESTful API that you use to interact directly with Sitecore items.

import requests

sHost = ""

def JSSGetItem():
	sUrl = sHost + "auth/login"
	print (sUrl)
	headers = {"Content-Type" : "application/json"}
	data = {"domain": "sitecore", "username": "uid",  "password": "pwd" }
	# Use 'with' to ensure the session context is closed after use.
	with requests.Session() as req:
	# Login
		resp =, headers = headers, json = data)
		if resp.ok:
			sText = resp.text
			print (sText)
			print ("Boo! {}".format(resp.status_code))
			print (resp.text)

	# Get Child Items
		sUrl = sHost + "item/{C4EA14BD-4F2F-4306-8E7F-A922B9C67E7E}/children?fields=ItemID,ItemName,Active Flag,Search Flag" # /sitecore/content/Global/Facets/Tags
		resp = req.get(sUrl)
		if resp.ok:
			sText = resp.text
			print (sText)
			data = json.loads(sText)
			for x in data:
				if x["Active Flag"]=="Y" and x["Search Flag"]=="Y":
					print(x["ItemName"] + " " + x["ItemID"]);			
			print ("Boo! {}".format(resp.status_code))
			print (resp.text)



Query string

Get item


Get item including metadata


Get item including standard template fields


Get item with field projection




Search with paging and field projection


Get media item


Get item using the content path