Issues importing feeds in JSON format

Hello,

I am trying to import JSON feeds in Drupal 8 to create content from Mongo DB and I’m having problems in the two approaches I tried:
1 ) Using Feeds extensible parsers
2 ) Using Single import with the Migration configuration type

With the Feeds extensible parsers and JSON JMESPath I have a couple of issues:

  • Warning : file_put_contents(/jmespath_df347a373b8f92aa0ae3dd920a5ec2f6.php): failed to open stream: Permission denied in JmesPath\CompilerRuntime->compile() (line 75 of /drupal/sites/jcop-drupal8.web.cern.ch/modules/feeds_ex/lib/mtdowling-jmespath.php/v2.4.0/src/CompilerRuntime.php ).
  • Unable to write the compiled PHP code to: /jmespath_df347a373b8f92aa0ae3dd920a5ec2f6.php (NULL)

Did anyone succeeded in creating feeds with JSON JMESPath?

In the second approach, I created a yaml file to specify the migration using the json_source plugin and selecting the Migration configuration type from admin/config/development/configuration/single/import
When I click on the import button I get the following error:

The configuration cannot be imported because it failed validation for the following reasons:

  • Configuration block.block.cern_comment_recent depends on the cern theme that will not be installed after import.
  • Configuration block.block.cern_system_main depends on the cern theme that will not be installed after import.

We really need to import contents periodically in a couple of Drupal sites and I don’t see the way to do it…
Any help would be much appreciated.

Regards,
Ivan.

Hi Ivan,

Could you give me the URL of your JSON feed to check its format and also the URL of your D8 website?

Hi Sotirios,

This is the JSON feed: http://cvl-edms-mongodb-02:28017/jcop/releases/
And the drupal site is https://jcop-drupal8.web.cern.ch

Thanks!
Ivan.

Hi Ivan,

The problem is the feed settings in your website. The configuration is wrong.

In Structure->Feed types edit the test feed that you created and change the parser to “JsonPath”. Then under the mappings tab in the context field you need to put $.rows.*

Then start mapping the field by selecting a target, choose the field you want to map and then the on the source the field name in your feed (e.g. releaseTitle).

After you finish with the mapping save and go to Content and under the fields tab you need to create a feed that will use the feed type that you just edited and then start pulling content.

I have created a new Feed type JCOP Feed with the proper settings and I have mapped the title field only to your content type.

Alsom I have created a feed for you already under Content/Feed tab named JCOP Feed data and tried to import the data. It works fine but it gives the error that it expects values in some of your fields of your content type and they can’t be null.

This is good. It works but you need to map all the field to your content type. I leave it with you.

Thanks a lot Sotirios!!! I’ll continue extending the feed type you created.
Cheers,
Ivan