Search code examples
curlibm-watsonconcept-insights

IBM Watson Concept Insights conceptual search using Curl to pass mutiple/an array of ids as a parameter


So, I am trying to pass multiple of ids ("Array of concept") on a query using Curl on IBM Concept Insights. According to the documentation on this site, I should be able to do it, but I cannot figure out how to make it work -> http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/concept-insights/api/v2/?curl#conceptual_search

If I use the "example request" prodiveded on the link and modify it to at least add another query on the same get data command, this is how I think it would work.

curl -u "{username}":"{password}" -G -d "ids=[\"/graphs/wikipedia/en-20120601/concepts/Artificial_intelligence\", \"/graphs/wikipedia/en-20120601/concepts/HTML\"]" "https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/public/ibmresearcher/conceptual_search"

When I enter that command, I get no results back. Not even an error.

Any thoughts?

Please don't point out the obvious... of course, I am replacing "{username}":"{password}" with my credentials. :)


Solution

  • Instead of -d "ids=..." you should use --data-urlencode "ids=..."

    This should work:

    curl -u "%ci-username%":"%ci-password%" -G --data-urlencode "ids=[\"/graphs/wikipedia/en-20120601/concepts/Artificial_intelligence\", \"/graphs/wikipedia/en-20120601/concepts/HTML\"]" "https://gateway.watsonplatform.net/concept-insights/api/v2/corpora/public/ibmresearcher/conceptual_search"