I'm learning how to create a custom JSON migration and referring to the migrate_json_example module, I see the following code in migrate_plus.migration.product.yml.

    - 'public://migrate_json_example/products.json'
  # An xpath-like selector corresponding to the items to be imported.
  item_selector: product

Can someone please tell me how to use that public:// part of the URL? I understand it's a path to the JSON file, but it's a relative path. I don't know how public:// is handled and how Drupal knows where to look for the files.

Both modules are installed on the same site. However, when I try using the same public:// URL in my module, I get the following error.

Error message: cURL error 1: Protocol "public" not supported or disabled in libcurl (see http://curl.haxx.se/libcurl/c/libcurl-errors.html) at public://migrate_stuff/resources/people1.json.

1 Answer 1


public:// is the sites public file system path. You can change it by navigation to admin/config/media/file-system. There you can set the public file system path, the default path is sites/default/files.

  • Thank you. I see my mistake now
    – sisko
    Jun 23, 2019 at 16:18
  • For anyone else referring to this question, my mistake was I thought the migrate code was reading the json file located in the example module. However, in the module.install file, the json is copied into sites/default/files where it actually reads from - hence public:// makes complete sense.
    – sisko
    Jun 23, 2019 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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