Jump to content
Sunny

I need to create content from a json feed.

Recommended Posts

I need to create content pragmatically. e.g. In the admin I plan on creating a button that will create a bunch of pages from a json feed. Is this possible? Can you point me to the correct API? Thanks.

Share this post


Link to post
Share on other sites

You use http://php.net/json_decode or a specific library to turn the json into a PHP array, and then use the PW API to create the pages. Here is a good example of how to do it: http://processwire.com/talk/topic/352-creating-pages-via-api

You might also want to have a look at the code of this module to take some ideas, since it does exactly that: https://github.com/adrianbj/ProcessPageTreeMigrator

  • Like 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...