Verb Path Method GET /posts/ Browse posts GET /posts/{id}/ Read a post by ID GET /posts/slug/{slug}/ Read a post by slug GET /authors/ Browse authors GET /authors/{id}/ Read an author by ID GET /authors/slug/{slug}/ Read a author by slug GET /tags/ Browse tags GET /tags/{id}/ Read a tag by ID GET /tags/slug/{slug}/ Read a tag by slug GET /pages/ Browse pages GET /pages/{id}/ Read a page by ID GET /pages/slug/{slug}/ Read a page by slug GET /tiers/
B r o w s e t i e r s G E T / s e t t i n g s / B r o w s e s e t t i n g s
T h e C o n t e n t A P I s u p p o r t s t w o t y p e s o f r e q u e s t : B r o w s e a n d R e a d .
B r o w s e e n d p o i n t s a l l o w y o u t o f e t c h l i s t s o f r e s o u r c e s , w h e r e a s R e a d e n d p o i n t s a l l o w y o u t o f e t c h a s i n g l e r e s o u r c e .
R e s o u r c e s
T h e A P I w i l l a l w a y s r e t u r n v a l i d J S O N i n t h e s a m e s t r u c t u r e :
{
"resource_type" : [{
...
}],
"meta" : {}
}
● r e s o u r c e _ t y p e : w i l l a l w a y s m a t c h t h e r e s o u r c e n a m e i n t h e U R L . A l l r e s o u r c e s a r e r e t u r n e d w r a p p e d i n a n a r r a y , w i t h t h e e x c e p t i o n o f / s i t e / a n d / s e t t i n g s / .
● m e t a : c o n t a i n s p a g i n a t i o n i n f o r m a t i o n f o r b r o w s e r e q u e s t s .
P o s t s
P o s t s a r e t h e p r i m a r y r e s o u r c e i n a G h o s t s i t e . U s i n g t h e p o s t s e n d p o i n t i t i s p o s s i b l e t o g e t l i s t s o f p o s t s f i l t e r e d b y v a r i o u s c r i t e r i a .
GET / content / posts /
GET / content / posts / { id } /
GET / content / posts / slug / { slug } /
B y d e f a u l t , p o s t s a r e r e t u r n e d i n r e v e r s e c h r o n o l o g i c a l o r d e r b y p u b l i s h e d d a t e w h e n f e t c h i n g m o r e t h a n o n e .
T h e m o s t c o m m o n g o t c h a w h e n f e t c h i n g p o s t s f r o m t h e C o n t e n t A P I i s n o t u s i n g t h e i n c l u d e p a r a m e t e r t o r e q u e s t r e l a t e d d a t a s u c h a s t a g s a n d a u t h o r s . B y d e f a u l t , t h e r e s p o n s e f o r a p o s t w i l l n o t i n c l u d e t h e s e :
{
"posts" : [
{
"slug" : "welcome-short" ,
"id" : "5ddc9141c35e7700383b2937" ,
"uuid" : "a5aa9bd8-ea31-415c-b452-3040dae1e730" ,
"title" : "Welcome" ,
"html" : "<p>👋 Welcome, it's great to have you here.</p>" ,
"comment_id" : "5ddc9141c35e7700383b2937" ,
"feature_image" : "https://static.ghost.org/v3.0.0/images/welcome-to-ghost.png" ,
"feature_image_alt" : null ,
"feature_image_caption" : null ,
"featured" : false ,
"visibility" : "public" ,
"created_at" : "2019-11-26T02:43:13.000+00:00" ,
"updated_at" : "2019-11-26T02:44:17.000+00:00" ,
"published_at" : "2019-11-26T02:44:17.000+00:00" ,
"custom_excerpt" : null ,
"codeinjection_head" : null ,
"codeinjection_foot" : null ,
"custom_template" : null ,
"canonical_url" : null ,
"url" : "https://docs.ghost.io/welcome-short/" ,
"excerpt" : "👋 Welcome, it's great to have you here." ,
"reading_time" : 0 ,
"access" : true ,
"og_image" : null ,
"og_title" : null ,
"og_description" : null ,
"twitter_image" : null ,
"twitter_title" : null ,
"twitter_description" : null ,
"meta_title" : null ,
"meta_description" : null ,
"email_subject" : null
}
]
}
P o s t s a l l o w y o u t o i n c l u d e a u t h o r s a n d t a g s u s i n g &include; = a u t h o r s , t a g s , w h i c h w i l l a d d a n a u t h o r s a n d t a g s a r r a y t o t h e r e s p o n s e , a s w e l l a s b o t h a p r i m a r y _ a u t h o r a n d p r i m a r y _ t a g o b j e c t .
W o r k i n g E x a m p l e
# cURL
# Real endpoint - copy and paste to see!
curl "https://demo.ghost.io/ghost/api/content/posts/?key=22444f78447824223cefc48062&include=tags,authors"
R e t u r n s :
{
"posts" : [
{
"slug" : "welcome-short" ,
"id" : "5c7ece47da174000c0c5c6d7" ,
"uuid" : "3a033ce7-9e2d-4b3b-a9ef-76887efacc7f" ,
"title" : "Welcome" ,
"html" : "<p>👋 Welcome, it's great to have you here.</p>" ,
"comment_id" : "5c7ece47da174000c0c5c6d7" ,
"feature_image" : "https://casper.ghost.org/v2.0.0/images/welcome-to-ghost.jpg" ,
"feature_image_alt" : null ,
"feature_image_caption" : null ,
"featured" : false ,
"meta_title" : null ,
"meta_description" : null ,
"created_at" : "2019-03-05T19:30:15.000+00:00" ,
"updated_at" : "2019-03-26T19:45:31.000+00:00" ,
"published_at" : "2012-11-27T15:30:00.000+00:00" ,
"custom_excerpt" : "Welcome, it's great to have you here." ,
"codeinjection_head" : null ,
"codeinjection_foot" : null ,
"og_image" : null ,
"og_title" : null ,
"og_description" : null ,
"twitter_image" : null ,
"twitter_title" : null ,
"twitter_description" : null ,
"custom_template" : null ,
"canonical_url" : null ,
"authors" : [
{
"id" : "5951f5fca366002ebd5dbef7" ,
"name" : "Ghost" ,
"slug" : "ghost" ,
"profile_image" : "https://demo.ghost.io/content/images/2017/07/ghost-icon.png" ,
"cover_image" : null ,
"bio" : "The professional publishing platform" ,
"website" : "https://ghost.org" ,
"location" : null ,
"facebook" : "ghost" ,
"twitter" : "@tryghost" ,
"meta_title" : null ,
"meta_description" : null ,
"url" : "https://demo.ghost.io/author/ghost/"
}
],
"tags" : [
{
"id" : "59799bbd6ebb2f00243a33db" ,
"name" : "Getting Started" ,
"slug" : "getting-started" ,
"description" : null ,
"feature_image" : null ,
"visibility" : "public" ,
"meta_title" : null ,
"meta_description" : null ,
"url" : "https://demo.ghost.io/tag/getting-started/"
}
],
"primary_author" : {
"id" : "5951f5fca366002ebd5dbef7" ,
"name" : "Ghost" ,
"slug" : "ghost" ,
"profile_image" : "https://demo.ghost.io/content/images/2017/07/ghost-icon.png" ,
"cover_image" : null ,
"bio" : "The professional publishing platform" ,
"website" : "https://ghost.org" ,
"location" : null ,
"facebook" : "ghost" ,
"twitter" : "@tryghost" ,
"meta_title" : null ,
"meta_description" : null ,
"url" : "https://demo.ghost.io/author/ghost/"
},
"primary_tag" : {
"id" : "59799bbd6ebb2f00243a33db" ,
"name" : "Getting Started" ,
"slug" : "getting-started" ,
"description" : null ,
"feature_image" : null ,
"visibility" : "public" ,
"meta_title" : null ,
"meta_description" : null ,
"url" : "https://demo.ghost.io/tag/getting-started/"
},
"url" : "https://demo.ghost.io/welcome-short/" ,
"excerpt" : "Welcome, it's great to have you here."
}
]
}
P a g e s
P a g e s a r e s t a t i c r e s o u r c e s t h a t a r e n o t i n c l u d e d i n c h a n n e l s o r c o l l e c t i o n s o n t h e G h o s t f r o n t - e n d .
T h e A P I w i l l o n l y r e t u r n p a g e s t h a t w e r e c r e a t e d a s r e s o u r c e s a n d w i l l n o t c o n t a i n r o u t e s c r e a t e d w i t h d y n a m i c r o u t i n g .
GET / content / pages /
GET / content / pages / { id } /
GET / content / pages / slug / { slug } /
P a g e s a r e s t r u c t u r e d i d e n t i c a l l y t o p o s t s . T h e r e s p o n s e o b j e c t w i l l l o o k t h e s a m e , o n l y t h e r e s o u r c e k e y w i l l b e p a g e s .
B y d e f a u l t , p a g e s a r e o r d e r e d b y t i t l e w h e n f e t c h i n g m o r e t h a n o n e .
T a g s a r e t h e p r i m a r y t a x o n o m y w i t h i n a G h o s t s i t e .
GET / content / tags /
GET / content / tags / { id } /
GET / content / tags / slug / { slug } /
B y d e f a u l t , i n t e r n a l t a g s a r e a l w a y s i n c l u d e d , u s e f i l t e r = v i s i b i l i t y : p u b l i c t o l i m i t t h e r e s p o n s e d i r e c t l y o r u s e t h e t a g s h e l p e r t o h a n d l e f i l t e r i n g a n d o u t p u t t i n g t h e r e s p o n s e .
T a g s t h a t a r e n o t a s s o c i a t e d w i t h a p o s t a r e n o t r e t u r n e d . Y o u c a n s u p p l y i n c l u d e = c o u n t . p o s t s t o r e t r i e v e t h e n u m b e r o f p o s t s a s s o c i a t e d w i t h a t a g .
{
"tags" : [
{
"slug" : "getting-started" ,
"id" : "5ddc9063c35e7700383b27e0" ,
"name" : "Getting Started" ,
"description" : null ,
"feature_image" : null ,
"visibility" : "public" ,
"meta_title" : null ,
"meta_description" : null ,
"og_image" : null ,
"og_title" : null ,
"og_description" : null ,
"twitter_image" : null ,
"twitter_title" : null ,
"twitter_description" : null ,
"codeinjection_head" : null ,
"codeinjection_foot" : null ,
"canonical_url" : null ,
"accent_color" : null ,
"url" : "https://docs.ghost.io/tag/getting-started/"
}
]
}
B y d e f a u l t , t a g s a r e o r d e r e d b y n a m e w h e n f e t c h i n g m o r e t h a n o n e .
A u t h o r s
A u t h o r s a r e a s u b s e t o f u s e r s w h o h a v e p u b l i s h e d p o s t s a s s o c i a t e d w i t h t h e m .
GET / content / authors /
GET / content / authors / { id } /
GET / content / authors / slug / { slug } /
A u t h o r s t h a t a r e n o t a s s o c i a t e d w i t h a p o s t a r e n o t r e t u r n e d . Y o u c a n s u p p l y i n c l u d e = c o u n t . p o s t s t o r e t r i e v e t h e n u m b e r o f p o s t s a s s o c i a t e d w i t h a n a u t h o r .
{
"authors" : [
{
"slug" : "cameron" ,
"id" : "5ddc9b9510d8970038255d02" ,
"name" : "Cameron Almeida" ,
"profile_image" : "https://docs.ghost.io/content/images/2019/03/1c2f492a-a5d0-4d2d-b350-cdcdebc7e413.jpg" ,
"cover_image" : null ,
"bio" : "Editor at large." ,
"website" : "https://example.com" ,
"location" : "Cape Town" ,
"facebook" : "example" ,
"twitter" : "@example" ,
"meta_title" : null ,
"meta_description" : null ,
"url" : "https://docs.ghost.io/author/cameron/"
}
]
}
S e t t i n g s
S e t t i n g s c o n t a i n t h e g l o b a l s e t t i n g s f o r a s i t e .
GET / content / settings /
T h e s e t t i n g s e n d p o i n t i s a s p e c i a l c a s e . Y o u w i l l r e c e i v e a s i n g l e o b j e c t , r a t h e r t h a n a n a r r a y . T h i s e n d p o i n t d o e s n ’ t a c c e p t a n y q u e r y p a r a m e t e r s .
{
"settings" : {
"title" : "Ghost" ,
"description" : "The professional publishing platform" ,
"logo" : "https://docs.ghost.io/content/images/2014/09/Ghost-Transparent-for-DARK-BG.png" ,
"icon" : "https://docs.ghost.io/content/images/2017/07/favicon.png" ,
"accent_color" : null ,
"cover_image" : "https://docs.ghost.io/content/images/2019/10/publication-cover.png" ,
"facebook" : "ghost" ,
"twitter" : "@tryghost" ,
"lang" : "en" ,
"timezone" : "Etc/UTC" ,
"codeinjection_head" : null ,
"codeinjection_foot" : "<script src=\"//rum-static.pingdom.net/pa-5d8850cd3a70310008000482.js\" async></script>" ,
"navigation" : [
{
"label" : "Home" ,
"url" : "/"
},
{
"label" : "About" ,
"url" : "/about/"
},
{
"label" : "Getting Started" ,
"url" : "/tag/getting-started/"
},
{
"label" : "Try Ghost" ,
"url" : "https://ghost.org"
}
],
"secondary_navigation" : [],
"meta_title" : null ,
"meta_description" : null ,
"og_image" : null ,
"og_title" : null ,
"og_description" : null ,
"twitter_image" : null ,
"twitter_title" : null ,
"twitter_description" : null ,
"members_support_address" : "noreply@docs.ghost.io" ,
"url" : "https://docs.ghost.io/"
}
}
T i e r s
T i e r s a l l o w p u b l i s h e r s t o c r e a t e m u l t i p l e o p t i o n s f o r a n a u d i e n c e t o b e c o m e p a i d s u b s c r i b e r s . E a c h t i e r c a n h a v e i t s o w n p r i c e p o i n t s , b e n e f i t s , a n d c o n t e n t a c c e s s l e v e l s . G h o s t c o n n e c t s t i e r s d i r e c t l y t o t h e p u b l i c a t i o n ’ s S t r i p e a c c o u n t .
U s a g e
T h e t i e r s e n d p o i n t r e t u r n s a l i s t o f t i e r s f o r t h e s i t e , f i l t e r e d b y t h e i r v i s i b i l i t y c r i t e r i a .
GET / content / tiers /
T i e r s a r e r e t u r n e d i n o r d e r o f i n c r e a s i n g m o n t h l y p r i c e .
{
"tiers" : [
{
"id" : "62307cc71b4376a976734037" ,
"name" : "Free" ,
"description" : null ,
"slug" : "free" ,
"active" : true ,
"type" : "free" ,
"welcome_page_url" : null ,
"created_at" : "2022-03-15T11:47:19.000Z" ,
"updated_at" : "2022-03-15T11:47:19.000Z" ,
"stripe_prices" : null ,
"benefits" : null ,
"visibility" : "public"
},
{
"id" : "6230d7c8c62265c44f24a594" ,
"name" : "Gold" ,
"description" : null ,
"slug" : "gold" ,
"active" : true ,
"type" : "paid" ,
"welcome_page_url" : "/welcome-to-gold" ,
"created_at" : "2022-03-15T18:15:36.000Z" ,
"updated_at" : "2022-03-15T18:16:00.000Z" ,
"stripe_prices" : null ,
"benefits" : null ,
"visibility" : "public"
}
]
}
W o r k i n g e x a m p l e
# cURL
# Real endpoint - copy and paste to see!
curl "https://demo.ghost.io/ghost/api/content/tiers/?key=22444f78447824223cefc48062&include=benefits,monthly_price,yearly_price"
r e t u r n s :
{
"tiers" : [
{
"id" : "61ee7f5c5a6309002e738c41" ,
"name" : "Free" ,
"description" : null ,
"slug" : "61ee7f5c5a6309002e738c41" ,
"active" : true ,
"type" : "free" ,
"welcome_page_url" : "/" ,
"created_at" : "2022-01-24T10:28:44.000Z" ,
"updated_at" : null ,
"stripe_prices" : null ,
"monthly_price" : null ,
"yearly_price" : null ,
"benefits" : [],
"visibility" : "public"
},
{
"id" : "60815dbe9af732002f9e02fa" ,
"name" : "Ghost Subscription" ,
"description" : null ,
"slug" : "ghost-subscription" ,
"active" : true ,
"type" : "paid" ,
"welcome_page_url" : "/" ,
"created_at" : "2021-04-22T12:27:58.000Z" ,
"updated_at" : "2022-01-12T17:22:29.000Z" ,
"stripe_prices" : null ,
"monthly_price" : 500 ,
"yearly_price" : 5000 ,
"currency" : "usd" ,
"benefits" : [],
"visibility" : "public"
}
],
"meta" : {
"pagination" : {
"page" : 1 ,
"limit" : 15 ,
"pages" : 1 ,
"total" : 2 ,
"next" : null ,
"prev" : null
}
}
}
P a r a m e t e r s
Q u e r y p a r a m e t e r s p r o v i d e f i n e - g r a i n e d c o n t r o l o v e r r e s p o n s e s . A l l e n d p o i n t s a c c e p t i n c l u d e a n d f i e l d s . B r o w s e e n d p o i n t s a d d i t i o n a l l y a c c e p t f i l t e r , l i m i t , p a g e a n d o r d e r .
T h e v a l u e s p r o v i d e d a s q u e r y p a r a m e t e r s M U S T b e u r l e n c o d e d w h e n u s e d d i r e c t l y . T h e c l i e n t l i b r a r i e s w i l l h a n d l e t h i s f o r y o u .
I n c l u d e
T e l l s t h e A P I t o r e t u r n a d d i t i o n a l d a t a r e l a t e d t o t h e r e s o u r c e y o u h a v e r e q u e s t e d . T h e f o l l o w i n g i n c l u d e s a r e a v a i l a b l e :
● P o s t s & P a g e s : a u t h o r s , t a g s
● A u t h o r s : c o u n t . p o s t s
● T a g s : c o u n t . p o s t s
● T i e r s : m o n t h l y _ p r i c e , y e a r l y _ p r i c e , b e n e f i t s
I n c l u d e s c a n b e c o m b i n e d w i t h a c o m m a , e . g . , &include; = a u t h o r s , t a g s .
F o r p o s t s a n d p a g e s :
● &include; = a u t h o r s w i l l a d d " a u t h o r s " : [ { . . . } , ] a n d " p r i m a r y _ a u t h o r " : { . . . }
● &include; = t a g s w i l l a d d " t a g s " : [ { . . . } , ] a n d " p r i m a r y _ t a g " : { . . . }
F o r a u t h o r s a n d t a g s :
● &include; = c o u n t . p o s t s w i l l a d d " c o u n t " : { " p o s t s " : 7 } t o t h e r e s p o n s e .
F o r t i e r s :
● &include; = m o n t h l y _ p r i c e , y e a r l y _ p r i c e , b e n e f i t s w i l l a d d m o n t h l y p r i c e , y e a r l y p r i c e , a n d b e n e f i t s d a t a .
F i e l d s
L i m i t t h e f i e l d s r e t u r n e d i n t h e r e s p o n s e o b j e c t . U s e f u l f o r o p t i m i z i n g q u e r i e s , b u t d o e s n o t p l a y w e l l w i t h i n c l u d e .
E . g . f o r p o s t s &fields; = t i t l e , u r l w o u l d r e t u r n :
{
"posts" : [
{
"id" : "5b7ada404f87d200b5b1f9c8" ,
"title" : "Welcome to Ghost" ,
"url" : "https://demo.ghost.io/welcome/"
}
]
}
( P o s t s a n d P a g e s o n l y )
B y d e f a u l t , o n l y h t m l i s r e t u r n e d , h o w e v e r e a c h p o s t a n d p a g e i n G h o s t h a s 2 a v a i l a b l e f o r m a t s : h t m l a n d p l a i n t e x t .
● &formats; = h t m l , p l a i n t e x t w i l l a d d i t i o n a l l y r e t u r n t h e p l a i n t e x t f o r m a t .
F i l t e r
( B r o w s e r e q u e s t s o n l y )
A p p l y f i n e - g r a i n e d f i l t e r s t o t a r g e t s p e c i f i c d a t a .
● &filter; = f e a t u r e d : t r u e o n p o s t s r e t u r n s o n l y t h o s e m a r k e d f e a t u r e d .
● &filter; = t a g : g e t t i n g - s t a r t e d o n p o s t s r e t u r n s t h o s e w i t h t h e t a g s l u g t h a t m a t c h e s g e t t i n g - s t a r t e d .
● &filter; = v i s i b i l i t y : p u b l i c o n t i e r s r e t u r n s o n l y t h o s e m a r k e d a s p u b l i c l y v i s i b l e .
T h e p o s s i b i l i t i e s a r e e x t e n s i v e ! Q u e r y s t r i n g s a r e e x p l a i n e d i n d e t a i l i n t h e f i l t e r i n g s e c t i o n .
L i m i t
( B r o w s e r e q u e s t s o n l y )
B y d e f a u l t , o n l y 1 5 r e c o r d s a r e r e t u r n e d a t o n c e .
● &limit; = 5 w o u l d r e t u r n o n l y 5 r e c o r d s .
● &limit; = a l l w i l l r e t u r n a l l r e c o r d s - u s e c a r e f u l l y !
P a g e
( B r o w s e r e q u e s t s o n l y )
B y d e f a u l t , t h e f i r s t 1 5 r e c o r d s a r e r e t u r n e d .
● &page; = 2 w i l l r e t u r n t h e s e c o n d s e t o f 1 5 r e c o r d s .
O r d e r
( B r o w s e r e q u e s t s o n l y )
D i f f e r e n t r e s o u r c e s h a v e a d i f f e r e n t d e f a u l t s o r t o r d e r :
● P o s t s : p u b l i s h e d _ a t D E S C ( n e w e s t p o s t f i r s t )
● P a g e s : t i t l e A S C ( a l p h a b e t i c a l l y b y t i t l e )
● T a g s : n a m e A S C ( a l p h a b e t i c a l l y b y n a m e )
● A u t h o r s : n a m e A S C ( a l p h a b e t i c a l l y b y n a m e )
● T i e r s : m o n t h l y _ p r i c e A S C ( f r o m l o w e s t t o h i g h e s t m o n t h l y p r i c e )
T h e s y n t a x f o r m o d i f y i n g t h i s f o l l o w s S Q L o r d e r b y s y n t a x :
● ℴ = p u b l i s h e d _ a t % 2 0 a s c w o u l d r e t u r n p o s t s w i t h t h e n e w e s t p o s t l a s t
F i l t e r i n g
G h o s t u s e s a q u e r y l a n g u a g e c a l l e d N Q L t o a l l o w f i l t e r i n g A P I r e s u l t s . Y o u c a n f i l t e r a n y f i e l d o r i n c l u d e d f i e l d u s i n g m a t c h e s , g r e a t e r / l e s s t h a n o r n e g a t i o n , a s w e l l a s c o m b i n i n g w i t h a n d / o r . N Q L d o e s n ’ t y e t s u p p o r t ’ l i k e ’ o r p a r t i a l m a t c h e s .
F i l t e r s t r i n g s m u s t b e U R L e n c o d e d . T h e { { g e t } } h e l p e r a n d c l i e n t l i b r a r y h a n d l e t h i s f o r y o u .
A t i t ’ s m o s t s i m p l e , f i l t e r i n g w o r k s t h e s a m e a s i n G M a i l , G i t H u b o r S l a c k - y o u p r o v i d e a f i e l d a n d a v a l u e , s e p a r a t e d b y a c o l o n .
S y n t a x R e f e r e n c e
F i l t e r E x p r e s s i o n s
A f i l t e r e x p r e s s i o n i s a s t r i n g w h i c h p r o v i d e s t h e p r o p e r t y , o p e r a t o r a n d v a l u e i n t h e f o r m p r o p e r t y : o p e r a t o r v a l u e :
● p r o p e r t y - a p a t h r e p r e s e n t i n g t h e f i e l d t o f i l t e r o n
● : - s e p a r a t o r b e t w e e n p r o p e r t y a n d a n o p e r a t o r - v a l u e e x p r e s s i o n
● o p e r a t o r ( o p t i o n a l ) - h o w t o c o m p a r e v a l u e s ( : o n i t s o w n i s r o u g h l y = )
● v a l u e - t h e v a l u e t o m a t c h a g a i n s t
P r o p e r t y
M a t c h e s : [ a - z A - Z _ ] [ a - z A - Z 0 - 9 _ . ]
● c a n c o n t a i n o n l y a l p h a - n u m e r i c c h a r a c t e r s a n d _
● c a n n o t c o n t a i n w h i t e s p a c e
● m u s t s t a r t w i t h a l e t t e r
● s u p p o r t s . s e p a r a t e d p a t h s , E . g . a u t h o r s . s l u g or p o s t s . c o u n t
● i s a l w a y s l o w e r c a s e , b u t a c c e p t s a n d c o n v e r t s u p p e r c a s e
V a l u e
C a n b e o n e o f t h e f o l l o w i n g
● n u l l
● t r u e
● f a l s e
● a n u m b e r ( i n t e g e r )
● a l i t e r a l
● A n y c h a r a c t e r s t r i n g w h i c h f o l l o w s t h e s e r u l e s :
● C a n n o t s t a r t w i t h - b u t m a y c o n t a i n i t
● C a n n o t c o n t a i n a n y o f t h e s e s y m b o l s : ' " + , ( ) > < = [ ] u n l e s s t h e y a r e e s c a p e d
● C a n n o t c o n t a i n w h i t e s p a c e
● a s t r i n g
● ' s t r i n g h e r e ' A n y c h a r a c t e r e x c e p t a s i n g l e o r d o u b l e q u o t e s u r r o u n d e d b y s i n g l e q u o t e s
● S i n g l e o r D o u b l e q u o t e _ _ M U S T _ _ b e e s c a p e d *
● C a n c o n t a i n w h i t e s p a c e
● A s t r i n g c a n c o n t a i n a d a t e a n y f o r m a t t h a t c a n b e u n d e r s t o o d b y n e w D a t e ( )
● a r e l a t i v e d a t e
● U s e s t h e p a t t e r n n o w - 3 0 d
● M u s t s t a r t w i t h n o w
● C a n u s e - o r +
● A n y i n t e g e r c a n b e u s e d f o r t h e s i z e o f t h e i n t e r v a l
● S u p p o r t s t h e f o l l o w i n g i n t e r v a l s : d , w , M , y , h , m , s
O p e r a t o r s
● - - n o t
● > - g r e a t e r t h a n
● > = - g r e a t e r t h a n o r e q u a l s
● < - l e s s t h a n
● < = - l e s s t h a n o r e q u a l s
● ~ = - c o n t a i n s
● ~ ^ - s t a r t s w i t h
● ~ $ - e n d s w i t h
● [ v a l u e , v a l u e , … ] - “ i n ” g r o u p , c a n b e n e g a t e d w i t h -
C o m b i n a t i o n s
● + - r e p r e s e n t s a n d
● , - r e p r e s e n t s o r
● ( f i l t e r e x p r e s s i o n ) - o v e r r i d e s o p e r a t o r p r e c e d e n c e
S t r i n g s v s L i t e r a l s
M o s t o f t h e t i m e , t h e r e ’ s n o n e e d t o p u t q u o t e s a r o u n d s t r i n g s w h e n b u i l d i n g f i l t e r s i n G h o s t .
I f y o u f i l t e r b a s e d o n s l u g s , s l u g s a r e a l w a y s c o m p a t i b l e w i t h l i t e r a l s .
H o w e v e r , i n s o m e c a s e s y o u m a y n e e d t o u s e a s t r i n g t h a t c o n t a i n s o n e o f t h e o t h e r c h a r a c t e r s u s e d i n t h e f i l t e r s y n t a x , e . g . d a t e s & t i m e s c o n t a i n : . U s e s i n g l e - q u o t e s f o r t h e s e .
A l l b r o w s e e n d p o i n t s a r e p a g i n a t e d , r e t u r n i n g 1 5 r e c o r d s b y d e f a u l t . Y o u c a n u s e t h e p a g e a n d l i m i t p a r a m e t e r s t o m o v e t h r o u g h t h e p a g e s o f r e c o r d s . T h e r e s p o n s e o b j e c t c o n t a i n s a m e t a . p a g i n a t i o n k e y w i t h i n f o r m a t i o n o n t h e c u r r e n t l o c a t i o n w i t h i n t h e r e c o r d s :
"meta" : {
"pagination" :{
"page" : 1 ,
"limit" : 2 ,
"pages" : 1 ,
"total" : 1 ,
"next" : null ,
"prev" : null
}
}
E r r o r s
T h e C o n t e n t A P I w i l l g e n e r a t e e r r o r s f o r t h e f o l l o w i n g c a s e s :
● S t a t u s 4 0 0 : B a d l y f o r m e d q u e r i e s e . g . f i l t e r p a r a m e t e r s t h a t a r e n o t c o r r e c t l y e n c o d e d
● S t a t u s 4 0 1 : A u t h e n t i c a t i o n f a i l u r e s e . g . u n r e c o g n i s e d k e y s
● S t a t u s 4 0 4 : U n k n o w n r e s o u r c e s e . g . d a t a w h i c h i s n o t p u b l i c
● S t a t u s 5 0 0 : S e r v e r e r r o r s e . g . w h e r e s o m e t h i n g h a s g o n e
E r r o r s a r e a l s o f o r m a t t e d i n J S O N , a s a n a r r a y o f e r r o r o b j e c t s .
T h e H T T P s t a t u s c o d e o f t h e r e s p o n s e a l o n g w i t h t h e e r r o r T y p e p r o p e r t y i n d i c a t e t h e t y p e o f e r r o r .
T h e m e s s a g e f i e l d i s d e s i g n e d t o p r o v i d e c l a r i t y o n w h a t e x a c t l y h a s g o n e w r o n g .
{
"errors" : [
{
"message" : "Unknown Content API Key" ,
"errorType" : "UnauthorizedError"
}
]
}
V e r s i o n i n g
S e e A P I v e r s i o n i n g f o r f u l l d e t a i l s o f t h e A P I v e r s i o n s a n d t h e i r s t a b i l i t y l e v e l s .
O n t h i s p a g e
A b o u t
C u s t o m e r s
C a r e e r s
R e s o u r c e s
P r o d u c t
● C r e a t o r p l a t f o r m
● T h e m e m a r k e t p l a c e
● I n t e g r a t i o n s
● F e a t u r e i n d e x
D e v e l o p e r s
● H o w t o i n s t a l l G h o s t
● C o r e c o n c e p t s
● G h o s t h o s t i n g
● A P I d o c u m e n t a t i o n
● S e c u r i t y o v e r v i e w
● S o u r c e c o d e
R e s o u r c e s
● G h o s t t u t o r i a l s
● R e s o u r c e s
● N o d e . j s C M S g u i d e
● O p e n S u b s c r i p t i o n P l a t f o r m s
C o m p a r i s o n s
● G h o s t v s S u b s t a c k
● G h o s t v s W o r d P r e s s
● G h o s t v s M e d i u m
● G h o s t v s M e m b e r f u l
● G h o s t v s P a t r e o n
● G h o s t a l t e r n a t i v e s →
S u p p o r t
● H e l p c e n t e r
● C o m m u n i t y f o r u m
● S t a t u s
T r i a n g l e
9 9 . 9 %
T e r m s
P r i v a c y
C o n t a c t
G h o s t F o u n d a t i o n © 2 0 2 2
👋 W e ' r e h i r i n g r e m o t e l y , w o r l d w i d e ! J o i n t h e t e a m t h a t ' s c r e a t i n g t h e c r e a t o r e c o n o m y — S e e o p e n r o l e s →