Connect a separate website or app to Morphic
Point a separate website or app at your Morphic content so it can load entries over the REST API.
Before you start
- You need the Administrator role to create API keys.
- At least one model must give See entries access to Everyone, or you need an API key for private content.
Copy the API address
- Go to API & integration.
- Copy the address next to REST API.
Allow public reads
If your content is public, use this section. Otherwise, go to the next section.
- Go to a model's Access tab.
- In the See entries row, select the checkbox in the Everyone column.
Create a key for private content
If your content is private, create an API key.
- Go to Settings > API keys.
- Select New API key.
- In Name, enter
Website. - In Models, select the models the site needs.
- Leave the Can also create, edit and delete checkbox cleared, so the key only reads.
- Select Create key.
- Select Copy key.
Request an entry
- In your frontend, request an entry, for example
GET https://example.com/wp-json/morphic/v1/items/book. Replace the base address with the one you copied. - If the content is private, send the key in the
X-Morphic-Keyheader.
Result
The response has status 200 and lists the entries as JSON in items.
Caching
The API & integration screen shows a notice about the object cache. If the notice reads "No persistent object cache.", the app suggests installing Redis or Memcached with an object-cache drop-in.