Neos as Headless CMS


(pawan kumar) #1

Can we use Neos as headless CMS?

Thanks,


(Roland Schütz) #2

Yes, you can easily output any content as JSON or GraphQL


(pawan kumar) #3

Thanks for the response.

Would you please help me in this.
So is there any endpoints or rest services written for the same since when I load any page, there is no rest call ( since it is based in MVC)

So ,in case I create put some content to any page, so how could get these data in JSON format through rest service call.

Please help me.

Thanks in advance


(Dmitri Pisarev) #4

If you don’t want to go with a GraphQL API, perhaps this article could be useful for you? http://dimaip.github.io/2015/11/15/react-neos/


(pawan kumar) #5

Thanks Dmitri.

Yes i have been through the above link and below too

https://www.youtube.com/watch?v=KwSwoSKx4cY

Please correct me, if my understanding is wrong.
So we are supposed to create the rest endpoints through writing scripting code and invoke the data from backends.

What currently neos does is, data fetch in template through MVC based pattern, so there is not existing api written which can be directly used to get the data into json format


(Dmitri Pisarev) #6

Yes, you are correct.
The only ready-made API that we have is for GraphQL (btw, we plan to make it a part of the core): https://github.com/bwaidelich/Wwwision.Neos.GraphQL


(Markus Günther) #7

Hi,

I would use a graphQL API like Dmitri already mentioned.
We actually have two nice packages:

composer require wwwision/neos-graphql

or

composer require "t3n/graphql"

If you don’t want that you can also render your content as json, but guess it is easier to use the APIs.

Another option would be the static site generation with Proton, but this is not recommended for production at the moment. But if that would be a nice option, give it a try and feel free to help making this production ready.

composer require \
  flowpack/photon-neos=@dev\
  flowpack/photon-fusion=@dev\
  flowpack/photon-common=@dev\
  flowpack/photon-cli=@dev

We had a talk at the neoscon this year. When the talk is online as single video I can post it here.

Hope that helps a bit.


(pawan kumar) #8

Great Help.
Really Thanks Dmriti & Markus for help.

I install the graphQL in the package and can see the UI too.

I am afraid, how to get list of the ready-made api so I could used.
Would you please where I can get the all list of ready-made api.

Thanks,
Pawan Kumar


(Dmitri Pisarev) #9

I’m sorry I’ve never used it myself, so don’t know what is your exact problem It seems there’s some server-side error (you can check the Flow logs to see what’s up).
Perhaps @bwaidelich could give you a hand?


(pawan kumar) #10

It is fine ,you really helped me to understand the things clearly.

Would someone please help me on that about how to get all those ready-made api endpoints so I could use through the GraphQL


(Viktor Isaak) #11

with GraphQL there is only one endpoint. The power is in the query language itself
Have a look at “Introspection” to learn how to discover a service’s abilities (schema)


(pawan kumar) #12

Thanks for the reply.

Still i am getting the error when hitting the uel /neos/graphql.
Please find the attached image,Would anyone please help us in this


(Viktor Isaak) #13

Which query did you enter? It looks like you didn’t write a query, yet or sent an empty one. I recommend starting with an instrospection query as mentioned above.


(pawan kumar) #14

Hi,

I used the below query and still showing the same issue.
{
node{
label
identifier
}
}

Even tried to run with curl command too ,showing the error

please find the attached screenshot for the same


(pawan kumar) #15

Would someone please help in this?


(Johannes Steu) #16

The error most likely indicates that there is an Exception thrown. Check Data/Logs/Exceptions for more detais or bring up the development console of chrome and check the network tab


(pawan kumar) #17

Thanks @stolle for help.

There is no error in Data/Logs folder but yes in chrome console ,below is the issue

However I checked with 4.2 and 4.3 version too,same issue occurs,didn’t do any other configuration, just run the below command

composer require wwwision/neos-graphql

Do I need to make some other changes for the same too.


(pawan kumar) #18

Below might be the root cause of that issue,Please find the attached file

Please help .


(Soren Malling) #19

I’m wondering of you followed the installation guide in the corresponding graphql packages

https://github.com/bwaidelich/Wwwision.GraphQL ?

It tells that you have to include the routes - and when you get HTML in return, it seems like to didn’t do that


(pawan kumar) #20

Hi Soren,

Thanks for the reply.
I just followed the below link where it is mentioned after run the composer require wwwision/neos-graphql.
We can directly invoke the /neos/graphql

https://github.com/bwaidelich/Wwwision.Neos.GraphQL

Even In the same concern ,above mentioned that there is already ready-made api.
We can consume easily them.

The link which you shared,I think is for when we want to customized or add new things to that.
Since graphql has been called through the /test url
Please correct me if i am wrong.