0

I am using the migration import to pull in events from a calendar service json api. I can capture and map almost all the event details except the start date which is contained within an array. I tried to use the extract plugin but can't quite get it to work.

"events": [
   {
      "event": {
         "id": 920693,
         "title": "This is the event",
         "url": "http://woodowloriginaldesigns.com/what-lies-beneath/",
         "photo_id": 481020,
         "detail_views": 892,
         "event_instances": [
             {
                 "event_instance": {
                     "id": 2711527,
                     "ranking": 0,
                     "event_id": 920693,
                     "start": "2017-06-28T00:00:00-04:00",
                     "end": null,
                     "all_day": true
                 }
            }
    ],
    "address": "124 Main Street USA",
    }
  }

I am trying to get the "start" date out of there. The process section for my yaml file for the start date currently looks like this:

field_importdate:
  plugin: extract
  source: event_instances
  index: 
    - 0 
    - event_instance
    - start

When I omit this, I can successfully pull in/map all the other fields with a drush migrate-import jobnamehere command.

  • How should my extract plugin be configured here to get the start date?

Happy to provide more details and entirety of yaml file if needed.

0

Have you tried mapping directly rather than using extract?

field_importdate: event_instances/0/event_instance/start
  • I have tried that with no success unfortunately. – sbbutkcin Jul 10 '17 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.