I am attempting to make a request to our Sitecore9
instance with Postman
:
Method:
POST
URL:
https://{{sitecorehost}}/sitecore/api/ssc/auth/login
Headers:
Content-Type:application/json
Body:
{
"domain": "sitecore",
"username": "{{sitecoreusername}}",
"password": "{{sitecorepassword}}"
}
In Postman
this returns a 403
, though I can easily login to the Sitecore
instance with the URL provided in my Postman
environment variables.
I have been provided an apikey
by the site admin but the authentication documentation does not appear to specify how this should be used or if I need to pass it in conjunction with the authentication values.
The documentation which does describe using an apikey also describes retrieving an item using it's GUID but when I request this in Postman
like this:
Method:
GET
URL:
https://{{sitecorehost}}/sitecore/api/ssc/aggregate/content/Items('{5AB4C9A0-5889-4F50-9D7F-D960A1015FA7}')?sc_apikey={{sitecoreapikey}}
Headers:
Content-Type:application/json
All I get is a 500 Internal Server Error
with this in the body
of the response:
"message": "Object reference not set to an instance of an object.",
There are different type of API keys in Sitecore, For Sitecore 9.0, you need to create a "OData Item API Key" from template /sitecore/templates/System/Services/OData Item API Key and not "API Key" in the core database below /sitecore/system/Settings/Services/API Keys/
Also you need to fill in Database in your API key, you can use value web likely this is your issue if you leave it empty you get the Error "Object reference not set to an instance of an object." in Sitecore 9.0
For AllowedControllers you can use value *
For Using Postman with login, After the login you get a cookie you need to use that in your getitem request. you can Download following Postman tool export file as Example.