I originally thought there was something wrong with my usage of URLRead. But then I switched from my Mathematica instance on Ubuntu 17.10 to an instance on OS X 10.11 and it works fine on OS X.

So... Is this an issue with my installation? Or a bug in Mathematica on Linux?

In addition to the problem below, another (most likely related) issue is with URLSubmit.

  HandlerFunctions -> <|"TaskFinished" -> Print|>]

This gives the following error.

    "MessageTemplate" :> MessageName[URLSubmit, "invak"],
    "MessageParameters" -> {
      Association["TaskFinished" -> Print]


I have a rest call that I'm using to talk to an Elasticsearch instance that looks like this with cURL.

curl -XGET "http://elastic00.example.com:9200/test-index/_search" -H 'Content-Type: application/json' -d'
  "query": {
    "match": {
      "_id": "AWDd8gqhdJ9xvhUtDICa"

I can use this with no problems if I run it as an external call from Mathematica.

   "-XGET", "http://elastic00.example.com:9200/test-index/_search",
   "-H", "Content-Type: application/json",
   "-d", "{\"query\":{\"match\":{\"_id\":\"AWDd8gqhdJ9xvhUtDICa\"}}}" 
  }, "StandardOutput"]

But when I use HTTPRequest with URLRead it doesn't work.

req = HTTPRequest[
    "Scheme" -> "http",
    "Domain" -> "elastic00.example.com",
    "Port" -> 9200,
    "Path" -> {"test-index", "_search"}|>],
   "ContentType" -> "application/json",
   "Body" -> ExportString[{"query" -> {"match" -> {"_id" -> "AWDd8gqhdJ9xvhUtDICa"}}}, "JSON"]


I get an error saying that it is an InvalidLocation

    "MessageTemplate" -> "Specified request is invalid", 
    "MessageParameters" -> Association[]]]
  • $\begingroup$ Does the host elastic00.example.com exists at all? Even ping can't resolve it. $\endgroup$ Jan 18, 2018 at 17:53
  • $\begingroup$ @AlexeyPopkov No that's just an example url. It's an internal site that unreachable externally anyway so I just used 'example.com'. I was trying to reproduce this with an externally accessible URL but then I found out that it's a Linux specific issue. So I figured it's not that relevant anyway. You can reproduce the issue with the URLSubmit example at the top. It's the first example in the the documentation for that function. $\endgroup$
    – Sean Lynch
    Jan 18, 2018 at 17:55

1 Answer 1


I think this was an issue with the system not being fully set up after installation. After a reboot of the OS, it works fine.


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.