IBM Watson Discovery news curl forbidden error - websphere

Trying to query Watson discovery news with the following curl command and get error 403 forbidden.
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments/system/collections/news-en/query?version=2019-04-30&query=relations.action.lemmatized:acquire&count=3&filter=entities.text:IBM&return=text"
I found documents on the IBM site to create and query your own environments but not help with how to access the news.

It turned out my url was incorrect. I got this to work.
curl -u "apikey":"{apikey}" "https://api.eu-gb.discovery.watson.cloud.ibm.com/instances/96a866f9-11bb-4b55-af26-a0f826807fec/v1/environments/system/collections/news-en/query?version=2019-04-30&query=enriched_title.semantic_roles:(action.normalized:acquire,object.entities:(type::Company))&count=3"

Your curl looks correct, which may indicate that your apikey is incorrect. Try running the curl command to list environments:
curl -u "apikey":"{apikey}" "https://gateway.watsonplatform.net/discovery/api/v1/environments?version=2019-04-30"
that should verify that you have the correct apikey.

Related

CURL gives empty response

I'm attempting to set up a manual back up process for elastic search with ansible.. but when I attempt to curl the elastic server page I get an empty response from the console. No error message, no text, just empty.
I run curl https://website.etc.com:500 and that gives me an SSL error stating that the peers certificate issuer has been marked as not trusted by the user.
So I attempt to ignore ssl and curl -k url:port and it gives me a blank line in the console.
Why can't I curl this website???

Can I use Elasticsearch https without cert and authentication

I successfully setup HTTPS for Elasticsearch server. Now I can use curl like curl -u elastic:111111 --cacerts "Path/to/my/cert" https://localhost:9200. How can I setup to use curl without user authentication and cert?
Sorry for my bad English :(

Laravel - Mailing system doesn't work on my Web server but gives cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

I am using Mailgun to send mail and It works well on my local server, but on my Web Server, where the site is hosted on HackFlix, It produces this error after sending
GuzzleHttp\Exception\ConnectException
cURL error 7: (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
I have done many research to this problem and i didn't get any correct answer that solves cURL error 7. Some people say that i should ping or nslookup smtp.mailgun.org but I don't have SSH shell access on my server. Please, what is the solution to this problem?

Can Google Appscript fetch information from a LDAP server?

I need to fetch a lot of information from LDAP server based on the data stored in a Google Sheet. Does google appscript have any library/module to do so?
If it was possible to execute shell commands in appscript like:
ldapsearch -H ldap://ldap.org.website.com -x -D cn=root -w secret -LLL -b "o=myhost" cn=root
Then it would have been easier. Do you know of any work-around for this?
You have no access to the shell in Apps Script. App Script does has HTTP and JDBC services. You would need to run one of those services as a bridge to your LDAP server.
HTTP to LDAP:
https://serverfault.com/questions/372112/is-there-a-simple-ldap-to-http-gateway-out-there
JDBC/LDAP driver:
http://www.openldap.org/jdbcldap/

Elasticsearch Shield Plugin - Users can not be authenticated, even users with Admin Privileges

I'm having an issue with the Shield plugin for Elasticsearch. I have installed elasticsearch so that it runs as a service, and I can see that it is running on port 9200.
If I enter curl http://localhost:9200 in my Mac terminal I get the correct elasticsearch output...
Recently I have been trying to upgrade from basic authentication to shield authentication. I installed shield and license using the following commands:
/usr/share/elasticsearch/bin/plugin install license/latest
/usr/share/elasticsearch/bin/plugin install shield/latest
This successfull installs shield and license plugins. They are contained within my /usr/share/elasticsearch/plugins directory on my Vagrant box.
So, now if I try to use curl -XGET http://localhost:9200 again, I get the following response:
{"error":{"root_cause":[{"type":"security_exception","reason":"missing
authentication token for REST request
[/]","header":{"WWW-Authenticate":"Basic
realm=\"shield\""}}],"type":"security_exception","reason":"missing
authentication token for REST request
[/]","header":{"WWW-Authenticate":"Basic
realm=\"shield\""}},"status":401}
This is good. I can not reach elasticsearch without proper authentication. So now I want to create a user to authenticate to elasticsearch. I use the command:
sudo ./esusers useradd testuser -p password -r admin
This creates a user 'testuser' with password 'password' with admin privileges.
I can verify that this user has been created using the following command:
sudo ./esusers list
This returns:
testuser : admin
So I now try to run the curl command again with this user:
curl -u testuser:password -XGET http://localhost:9200
But I get the same error message as before when I tried without the admin user.
What is the issue here? Why is my admin user not authenticating?
You said that your verified the user is created using sudo ./esusers list but still the curl command fails. Chances are that you are using custom directory for elasticsearch even though the home dir is /usr/share/elasticsearch. And due to this, the esusers creates the users in /etc/elasticsearch/shield/ directory but they need to be copied to the custom dir, in case you are using one.
I know you've solved this differently but I'm answering this in the hope that it helps someone else in future. Can you confirm regarding the custom dir? For e.g in my case, the custom dir was /data/elasticsearch and the home dir was /usr/share/elasticsearch

Resources