Web Studio is here! An enhanced experience to make it easier to create, preview, and collaborate on your website contentLearn More
The Content Fetch API is a Rest API endpoint for all the Content and Pages in your Agility Instance. The API is hosted and maintained by Agility and does not require any setup or other web hosts.
Benefits
Methods
We provide SDKs (official and community-based) for a variety of frameworks and programming languages, and more will be added to this list over time.
We recommend using an official SDK to access your content when possible. You can use the REST API with any other programming language or framework.
Whether you are hitting the Content Fetch REST API over HTTP directly or through an SDK, you'll need to know a few things about your instance to authenticate your requests, all of which can be found under Settings > API Keys
API URL
This is the URL that your API requests will be sent to. Some client SDKs, such as the Content Fetch JS SDK will resolve this automatically for you.
GUID
This is your instance's unique identifier.
API Type
There are two types of API Keys, preview and fetch. One for previewing content, and the other to view only published content.
API Key
This is your secret API Key used for authentication that must be included in the header for each REST API request. It must support the apiType you are requesting. You can create as many API Keys as you see fit. API Keys may also have an optional expiry date.
Making a call to the Content Fetch API requires that you know your API Key, API URL (if calling the REST API directly over HTTP), or your GUID and Live/Preview API Keys if you are using an official SDK.
Your API Keys can be retrieved by logging into Agility and heading to Settings > API Keys.
From this same page, you can Add, Edit or Delete API Keys as needed. When editing, you can set their Name, Type and Expiry as well as Enable or Disable them rather than deleting.
You can test an API at any time on Swagger
To make an Authenticated HTTP request to the Content Fetch API, you need the following values:
The following example requests a List of content from Agility based on the reference name posts:
curl https://api.aglty.io/e13c7b01-u/preview/en-us/list/posts --header "APIKey: defaultpreview.fbe570b5cb1c8b2717fa01538d8ab43a0acad75a78c3620abd274c1186d12266"
The response for the request is provided in JSON
{
"items": [
{
"contentID": 124,
"properties": {
"state": 2,
"modified": "2021-04-01T10:15:59.907",
"versionID": 916,
"referenceName": "posts",
"definitionName": "Post",
"itemOrder": 3
},
"fields": {
"title": "Virtual Tours - Ways to Travel From Home",
"slug": "virtual-tours-ways-to-travel-from-home",
"date": "2021-03-31T13:17:50+00:00",
"category": {
"contentID": 110,
"properties": {
"state": 2,
"modified": "2021-03-23T09:24:26.82",
"versionID": 710,
"referenceName": "categories",
"definitionName": "Category",
"itemOrder": 1
},
"fields": { "title": "Travel Guide" }
},
"image": {
"label": "Virtual Tour",
"url": "https://cdn.aglty.io/blog-starter-2021-template/posts/virtual-tour_20210331171226_0.jpg",
"target": null,
"filesize": 279207,
"pixelHeight": "1542",
"pixelWidth": "2048",
"height": 1542,
"width": 2048
},
"content": "<p>Virtual tours can open up amazing and awe-inspiring locations around the world that may otherwise be inaccessible to you. You can experience the majesty of the Sistine Chapel, the wonder of the Great Wall of China, or the beauty of Hawaii from the comfort of your own home.</p>\r\n<h2>Picking the Right Virtual Tour for You</h2>\r\n<p>As you consider which virtual tour you want to take, try finding one that not only helps you explore a new place, but consider a place tied to your heritage. Learning more about your cultural heritage can help you become more resilient as you develop a deeper understanding of your story.</p>\r\n<h2>1. Vatican Museums</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/vatican-museum.jpg\" alt=\"Vatican Museum\" /></p>\r\n<p>This collection of virtual tours lets you see some of the masterpieces of the Renaissance, including the Sistine Chapel, Niccoline Chapel, Raphael’s Room, and more.</p>\r\n<p><a href=\"http://www.museivaticani.va/content/museivaticani/en/collezioni/musei/tour-virtuali-elenco.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"><em>Start the Tour</em></a><em></em></p>\r\n<h2>2. Great Wall of China</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/great-wall-of-china.jpg\" alt=\"Great Wall of China\" /></p>\r\n<p>The Great Wall is often regarded as a wonder of the world, making it a prime tourist attraction. By taking the tour online, you can skip the crowds and still experience the incredible view and Chinese history.</p>\r\n<p><a href=\"https://www.thechinaguide.com/destination/great-wall-of-china\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"><em>Start the Tour</em></a></p>\r\n<h2>3. Louvre</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/louvre.jpg\" alt=\"Louvre\" /></p>\r\n<p>The Louvre, located in Paris, is the largest art museum in the world. Three of the museum’s top exhibits are available online.</p>\r\n<p><a href=\"https://www.louvre.fr/en/visites-en-ligne#tabs\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"><em>Start the Tour</em></a></p>\r\n<h2>4. Taj Mahal</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/taj-mahal.jpg\" alt=\"Taj Mahal\" /></p>\r\n<p>This ivory marble mausoleum in India is one of the most famous buildings in the world. Emperor Shah Jahan had it built in 1632 for his wife Mumtaz Mahal.</p>\r\n<p><a href=\"https://www.airpano.com/360photo/Taj-Mahal-India/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\"><em>Start the Tour</em></a></p>\r\n<h2>5. Create Your Own Virtual Tour</h2>\r\n<p><span>With the help of </span><a href=\"https://www.google.com/maps\" target=\"_blank\" rel=\"noopener\">Google Maps</a><span> or </span><a href=\"https://www.google.com/earth/\" target=\"_blank\" rel=\"noopener\">Google Earth</a><span>, you can explore almost any location in the world. If you need ideas of places to visit, use the opportunity to virtually </span><a href=\"https://www.familysearch.org/blog/en/heritage-tourism/\" target=\"_blank\" rel=\"noopener\">explore the places of your heritage</a><span>. Traveling to understand the past and particularly your ancestors will help you gain a connection to your </span><a href=\"https://www.familysearch.org/blog/en/what-is-heritage/\" target=\"_blank\" rel=\"noopener\">heritage</a><span> and a sense of your roots.</span></p>\r\n<p><span><a href=\"https://www.familysearch.org/blog/en/virtual-tours-travel-from-home/\" target=\"_blank\" rel=\"noopener\">Article Source</a></span></p>\r\n<p></p>",
"categoryID": "110"
},
"seo": null
},
{
"contentID": 113,
"properties": {
"state": 2,
"modified": "2021-04-01T10:14:26.373",
"versionID": 914,
"referenceName": "posts",
"definitionName": "Post",
"itemOrder": 2
},
"fields": {
"title": "Am-EH-zing Places to Visit in Canada!",
"slug": "am-eh-zing-places-to-visit-in-canada",
"date": "2021-03-23T13:38:00+00:00",
"category": {
"contentID": 110,
"properties": {
"state": 2,
"modified": "2021-03-23T09:24:26.82",
"versionID": 710,
"referenceName": "categories",
"definitionName": "Category",
"itemOrder": 1
},
"fields": { "title": "Travel Guide" }
},
"image": {
"label": "Visit the beautiful Alps in Switzerland",
"url": "https://cdn.aglty.io/blog-starter-2021-template/posts/canadian.jpg",
"target": null,
"filesize": 143582,
"pixelHeight": "830",
"pixelWidth": "1200",
"height": 830,
"width": 1200
},
"content": "<p>Canada's cities and towns offer travelers a diverse choice of experiences, from chic, cosmopolitan centers to mountain resorts and maritime cities. Determining the best places to visit may depend on your interests and the type of trip you're hoping to create.</p>\r\n<h2 id=\"CDN-BC-BCV\" class=\"sitename\">1. Vancouver</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/vancouver.jpeg\" alt=\"Vancouver\" /></p>\r\n<p>For beauty, climate, a fun atmosphere, and plenty of things to do, you can't go wrong planning a trip to Vancouver. Set on the shores of the Pacific Ocean and backed by snow-capped mountains, this is an active city, where locals enjoy the outdoors year-round.</p>\r\n<p>Sunbathers can bask on the beaches in summer, and skiers can hit the nearby ski resorts in winter. At any time of year, you can walk the seawall or stroll through the towering trees in<span> </span><a href=\"https://www.planetware.com/vancouver/stanley-park-vancouver-cdn-bc-bcvsp.htm\" target=\"_blank\" rel=\"noopener\">Stanley Park</a>, enjoy fine dining or a casual meal while watching the sunset, or find fabulous shopping, from the markets of<span> </span><b>Granville Island</b><span> </span>to the high-end shops in the city center.</p>\r\n<h2 id=\"CDN-ON-ONNF\" class=\"sitename\">2. Niagara Falls</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/niagara-falls.jpeg\" alt=\"Niagara Falls\" /></p>\r\n<p>Canada's most famous natural attraction, the majestic Niagara Falls has been drawing sightseers almost since its discovery. The great wall of water pounding over the falls is an amazing sight, and the view and access afforded visitors is astounding. You can literally walk up to the edge of the falls, separated only by a cast-iron railing, and see the water as it disappears over the crest.</p>\r\n<p>The city that has developed here, also named Niagara Falls, has been greatly influenced by the people and atmosphere the falls have created. Stuntmen and daredevils have been tempting their fate on the falls throughout the decades, and as a result, a carnival-style atmosphere has come to define this unique city. Just a short drive from Toronto, Niagara Falls is easy to reach, and the city is a fun place to spend a day or two.</p>\r\n<h2>3. Toronto</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/toronto.jpeg\" alt=\"Toronto\" /></p>\r\n<p>As Canada's largest city, Toronto is the country's cultural hot spot, with ballet, opera, symphony, and Broadway shows. It's also home to the landmark<span> </span><strong>CN Tower</strong>. Add extraordinary shopping, fine dining, and fantastic museums, and there is no end to the entertainment.</p>\r\n<p>In recent years, Toronto's waterfront has experienced ongoing development and now boasts beautiful walking areas, restaurants, and in summer, outdoor concerts and cultural performances.</p>\r\n<p>Just outside the city center, in either direction from the city, are beautiful beaches, perfect on hot summer days. In winter, a public skating rink springs to life outside city hall, and unique winter events, including the popular<span> </span><b>Winterlicious</b>, add to the fun. You can find<span> </span><a href=\"https://www.planetware.com/canada/top-rated-ski-resorts-near-toronto-cdn-1-197.htm\" target=\"_blank\" rel=\"noopener\">ski resorts near Toronto<span> </span></a>as well.</p>\r\n<h2>4. Montreal</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/montreal.jpeg\" alt=\"Montreal\" /></p>\r\n<p>Montreal is a unique city, with a beautiful old historic district dating back to the 1600s and a modern city center with extensive underground shopping.<span> </span><b>Old Montreal</b><span> </span>is the main tourist hub, with cobbled streets and fantastic old buildings.</p>\r\n<p>Montreal is also home to a large number of fashion designers, and high-end boutiques line the historic streets, along with quaint hotels and restaurants. Located in the French-speaking<span> </span><a href=\"https://www.planetware.com/tourist-attractions-/quebec-province-cdn-qu-qu.htm\" target=\"_blank\" rel=\"noopener\">province of Québec</a>, Montreal has its own cultural identity, but English-speaking visitors will have no trouble communicating with anyone in the tourist industry.</p>\r\n<h2>5. Banff</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/banff.jpeg\" alt=\"Banff\" /></p>\r\n<p>The charming mountain town of Banff, in the stunning<span> </span><b>Banff National Park</b>, is a must-visit destination for anyone looking to explore the Rocky Mountains and see some of the most beautiful scenery in Canada. This is undeniably a tourist town, catering to international travelers from all over the globe.</p>\r\n<p>Just a short distance from the town is Lake Louise Ski Resort and Sunshine Village Ski Resort, two of<span> </span><a href=\"https://www.planetware.com/canada/top-rated-ski-resorts-in-canada-cdn-1-65.htm\" target=\"_blank\" rel=\"noopener\">Canada's best ski resorts</a>. In summer, the nearby turquoise lakes, including Lake Louise, and glacier-capped mountains are a glorious sight.</p>\r\n<p>But you don't even need to leave the town to enjoy a gondola ride to the top of a mountain for dinner, soak in a hot spring-fed pool, find fabulous shopping, discover lovely walking trails, and possibly see elk and woodland caribou that frequently make their way into town.</p>\r\n<p><a href=\"https://www.planetware.com/canada/best-places-to-visit-in-canada-cdn-1-12.htm\" target=\"_blank\" rel=\"noopener\">Article Source</a></p>\r\n<p></p>",
"categoryID": "110"
},
"seo": null
},
{
"contentID": 112,
"properties": {
"state": 2,
"modified": "2021-03-31T10:36:55.837",
"versionID": 884,
"referenceName": "posts",
"definitionName": "Post",
"itemOrder": 1
},
"fields": {
"title": "Travel Photography Tips: 101",
"slug": "travel-photography-101",
"date": "2021-03-23T13:37:00+00:00",
"category": {
"contentID": 109,
"properties": {
"state": 2,
"modified": "2021-03-23T09:24:14.623",
"versionID": 708,
"referenceName": "categories",
"definitionName": "Category",
"itemOrder": 0
},
"fields": { "title": "Travel Tips" }
},
"image": {
"label": "Travel Photography 101",
"url": "https://cdn.aglty.io/blog-starter-2021-template/posts/travel-photography_20210331143648_0.jpg",
"target": null,
"filesize": 293833,
"pixelHeight": "2048",
"pixelWidth": "2048",
"height": 2048,
"width": 2048
},
"content": "<p class=\"\">Photographs are often the best souvenir of your travels. But the worst thing is when they come out blurry, blown out, or just not all that exciting to look at.</p>\r\n<p class=\"\">If you want to learn how to take better pictures on your travels around the world, this article is packed with everything you need to improve your photography skills.</p>\r\n<h2>1. Set your camera to shoot in burst mode</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/whale-watching.jpg\" alt=\"Whale Watching\" /></p>\r\n<p class=\"\">Setting your camera to \"burst\" mode means that several shots will be taken with a single click of the shutter. This is especially helpful when you’re trying to take an action shot, like a whale breaching the water’s surface. </p>\r\n<p class=\"\">Also, burst mode is a good idea when handing your camera to a stranger to take your photo. You will get several to choose from, instead of just one where you’re blinking and someone is photo-bombing in the background. I always have my camera set in burst mode so we can choose our favorite photo from a series. </p>\r\n<h2>2. Carry a small tripod</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/beach-sunset.jpeg\" alt=\"Beach Sunset\" /></p>\r\n<p class=\"\">A tripod will seriously up your photo-taking game. There are several reasons for this but one of the main reasons we carry a tripod is so we can get shots of epic landscapes with ourselves in the picture. </p>\r\n<p class=\"\">If you're in a remote location, there might not be anyone around to take your photo. And even when there are tons of people around, they might not take shots you’re happy with. </p>\r\n<p class=\"\">When you travel with a tripod, you can always get a great photo of yourself because you are in control.</p>\r\n<h2>3. Shoot early and late</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/kyoto-sunset.jpeg\" alt=\"Kyoto Sunset\" /></p>\r\n<p class=\"\">No matter how talented of a photographer you may be, there are certain times of the day where your shot just won’t look as good. For instance, during the middle of the day when the sun is at its peak in the sky, the light is harsh and your photos will tend to have strong shadows. Instead, aim to take photos when the sun is low in the sky and it'll cast a warm glow instead of harsh white light.</p>\r\n<p class=\"\">The most ideal times of the day to take photos are in the morning just after sunrise, and during that magical “golden hour” just before sunset. Try to arrive at locations you want to shoot during these times. Of course there are many times when you can’t arrive at the ideal time, but it’s a good rule to follow whenever possible.</p>\r\n<h2>4. Don’t be afraid of a little rain (or clouds!)</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/raindrop-flowers.jpeg\" alt=\"Rain Droplets on Flowers\" /></p>\r\n<p class=\"\">Cloudy days can sometimes be disappointing when you’re on vacation, but they often make for the most interesting photos. Clouds soften the sun’s light, acting like a natural light box, and make it possible for you to get great shots even in the peak of the afternoon. They can also create a cool, moody effect and can make your pictures more interesting than if you have a clear blue sky. </p>\r\n<p class=\"\">Much the same, many people get nervous to take their camera out in the rain. But rainy shots can be super interesting.</p>\r\n<h2>5. Get a different perspective</h2>\r\n<p><img src=\"https://cdn.aglty.io/gixkprai/posts/taj-mahal-unique-prespective.jpeg\" alt=\"Taj Mahal Unique Prespective\" /></p>\r\n<p class=\"\">It can be a good idea to get inspiration by searching online for famous shots of iconic places. For instance, a quick Google search of “Taj Mahal” will show you the most famous angles this landmark is shot from. </p>\r\n<p class=\"\">But in order to really improve your photography skills, do the OPPOSITE. When everybody is taking pictures to the right, turn left. Look up. Look down. Don’t be afraid to get down on the ground and shoot from below.</p>\r\n<p class=\"\">Walk to a less crowded side of the landmark and take a picture from that lesser-seen angle, like the photo of the Taj Mahal above.</p>\r\n<p class=\"\"><a href=\"https://www.twowanderingsoles.com/blog/32-easy-creative-travel-photography-tips\" target=\"_blank\" rel=\"noopener\">Article Source</a></p>",
"categoryID": "109"
},
"seo": null
}
],
"totalCount": 3
}
GUID, API Key, and API Type.
Since each type of API request is a GET request, all parameters (aside from the API Key) are set in the URL path.
All requests follow this pattern:
https://api.aglty.io/{guid}/{apitype}/{locale}/{requestType}/{requestParams}
When you request a Content Item or a Page, the properties object contains a state property which tells you what the current state of the Item is. This value is an integer.
The following enum represent the actual state.
Our API and assets are available via a content delivery network (CDN) which is distributed globally. The server closest to your user will serve all content and assets, thus minimizing latency and benefiting your website or application.
Our rate limits decide the number of requests a client can make to our API in a certain amount of time. All requests have a per-second rate limit.
If your response is cached on our CDN, it will not count towards your rate limit. Our API enforces a limit of 10 direct requests per 1 second.
When fetching content that has Linked Content, you'll notice that the API may return a reference name instead of the actual content you were expecting. We do this to ensure you're not always over-fetching content.
Depending on how deeply linked your Content Architecture is, we supply a ContentLinkDepth query parameter for our API that lets you define how much Linked Content you would like to fetch.
The default value for ContentLinkDepth is 1, and the maximum value that can be passed is 5.
ContentLinkDepth works in conjunction with the query parameter ExpandAllContentLinks. If set to true, Linked Content will be expanded in the response.
Example 1
https:/api.aglty.io/{GUID}/fetch/en-us/list/example?ContentLinkDepth=1&ExpandAllContentLinks=false
This request will return the following response:
{
"items": [
{
"contentID": 94,
"properties": {},
"fields": {
"field": {
"referencename": "example1"
}
}
}
],
"totalCount": 1
}
Example 2
https:/api.aglty.io/{GUID}/fetch/en-us/list/example?ContentLinkDepth=1&ExpandAllContentLinks=true
This request will return the following response:
{
"items": [
{
"contentID": 94,
"properties": {},
"fields": {
"field": [
{
"contentID": 95,
"properties": {},
"fields": {
"field": {
"referencename": "example2"
}
}
}
]
}
}
],
"totalCount": 1
}
Example 3
https:/api.aglty.io/{GUID}/fetch/en-us/list/example?ContentLinkDepth=2&ExpandAllContentLinks=true
This request will return the following response:
{
"items": [
{
"contentID": 94,
"properties": {},
"fields": {
"field": [
{
"contentID": 95,
"properties": {},
"fields": {
"field": [
{
"contentID": 96,
"properties": {},
"fields": {
"field": {
"referencename": "example3"
}
}
}
]
}
}
]
}
}
],
"totalCount": 1
}
We have Bandwidth Restrictions set in place to monitor your total bandwidth of assets and API calls available per month. To view more information on Bandwidth Restrictions, refer to our Pricing page.
Further Reading