I'm trying to use IBM Watson Natural language Classifier but I can't proceed and load my answers. For some reason, username and password aren't working all the time.
This one executed fine:
curl -u username:password -F training_data=#questions.csv -F
training_metadata="{\"language\":\"en\",\"name\":\"my_classifier\"}"
"https://url/v1/classifiers"
But when I try to execute the following command, it doesn't work:
curl -u username:password -X POST -H "Content-Type: application/json"
-d #questions-with-classifier-ega-war/target/classes/answers.json http://yourAppName.mybluemix.net/api/v1/manage/answer
It just asks for the user and password again and again. It is the same password that just worked in the first curl command.
Thanks in advance!
I think you are confusing the service credentials (the one you use in the first command) with the credentials used to manage the database in one of the sample applications "Questions on Classifier" (see pom.xml).
In order to run your second command make sure you use the credentials from the pom.xml in your root directory
Related
I am trying to just select the bucket from Couchbase, I am unable to do so As I am following the link below which does not contain adequate and basic information. And there after I want to insert the document into the bucket as well using simple curl command. I tried using material avaiable on google but it wont help me on that. Please help me out to make simple select and Insert query for same..Thank you in advance
curl -v http://localhost:8091/query/service -d 'statement=SELECT Emp Id FROM Employee WHERE META().id ="01"'
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/curl.html
Bucket contains data as -
Checkout query service REST API (docs link: https://docs.couchbase.com/server/current/n1ql/n1ql-rest-api/index.html)
Also CURL must send request to query service port (8093), OR use couchbase SDKs
curl -v -u user:pass http://localhost:8093/query/service -d 'statement=SELECT `Emp Id` FROM Employee USE KEYS "Emp Id:01"'
curl -v -u user:pass http://localhost:8093/query/service -H "Content-Type: application/json" -d '{"statement":"SELECT `Emp Id` FROM Employee USE KEYS \"Emp Id:01\""}'
I am developing a dashboard that connects to Splunk via REST API and displays data on various charts/graphs etc. In order to get the data I have to make a POST request via curl (node.js). Everything is working great. However when I try to make a Post request with a dbxquery, it fails and returns 'fatal dbxquery unknown command.' I was wondering if anyone had encountered this before.
curl -H 'Authorization: Basic auth token' -k https://devfg.com:8089/services/search/jobs -d search=" | dbxquery query=\"SELECT count(*) FROM db.table\" connection=\"connection\"" -d output_mode=json
Are the permissions for the dbxquery command set to be executable from any app? Check under app permissions to see if the command is globally exported.
Alternatively, you may need to escape the *, so \*.
Otherwise, you should be able to run the dbxquery via a curl command.
I need to use POST method for a REST API.It's working perfectly in SOAP UI while i select "Preemptive Authentication" , I need to assemble this authentication option in Curl.
At Web service , preemptive properties has not set. It has only Basic authentication system with username & password.
I have tried --anyauth , it's not working. I have below command.
curl -X POST -H "content-type:application/json" --verbose -u username:password http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'
I am always getting below error.
{"Message":"Authorization has been denied for this request."}
I had tried with providing base64 encoded value of user & password at header section instead of providing user & password under user section ,and it got worked for me.
curl -X POST -H "content-type:application/json" --verbose -H "Authorization: Basic Base64_encoded_value_of_user_&_password" http://example.net:1234/api/Flows/UpdateStatus -d '{"EventId": "123","Status": "success"}'
I am following the instructions at: http://apiaxle.com/docs/statistics-and-analytics-in-apiaxle/ . Unfortunately currently (May 17, 2014) apiAxle is redirecting me to the endPointserver and I am not getting statist
menelaos:~$ curl 'http://localhost:3000/v/api/test/stats?
granularity=hour&format_timestamp=ISO'
Response:
{"meta":{"version":1,"status_code":404},"results":{"error":
{"type":"ApiUnknown","message":"No api specified (via subdomain)"}}}
I also tried using the subdomain but that didn't work either:
menelaos:~$ curl 'http://test.api.localhost:3000/v/api/test/stats?granularity=hour&format_timestamp=ISO'
Typically you run multiple instances of apiaxle-proxy (which provides access to your endpoints), and a single instances of apiaxle-api (which provides access to statistics, key creation, and other API management functionality).
For example, you might be running the proxy like this:
apiaxle-proxy -f 1 -p 3000 -q
To run the API, you would run something like this:
apiaxle-api -f 1 -p 5000 -q
Note that the API needs to run on a separate port. Also note that it shouldn't be accessible to the outside world as it doesn't have any authentication.
Using the above example, your curl command would look like this:
curl -H 'content-type: application/json' \
-X GET \
'http://localhost:5000/v1/api/test/stats' \
-d '{"granularity":"hour","format_timestamp":"ISO"}'
Note that the parameters need to be sent as JSON.
I am developing an application that uses the JIRA 6.1 REST API. Can I know a sample JSON Object that I should use, to add a user to a given group in JIRA?
This is the relevant API call: https://docs.atlassian.com/jira/REST/latest/#d2e1694
curl -D- -u admin:password -X POST --data "{\"name\": \"charlie\",\"password\": \"abracadabra\",\"emailAddress\": \"charlie#atlassian.com\",\"displayName\": \"Charlie of Atlassian\"}" -H "Content-Type: application/json" http://jira.server.com/rest/api/2/user/
For more info see. Expand part under application/json, there you can find data example.
How to send queries, refer to Atlassian's documentation.
Came across this thread while looking to do the exact same thing. The answer from #ThePavolC was very good, but it is creating a new user, not adding a user to a group. I combined his answer with info from https://answers.atlassian.com/questions/255778 and came up with this one-liner:
curl --insecure -D- -u admin:password -X POST --data "{\"name\": \"username\"}" -H "Content-Type: application/json" https://myjiraserver.com/rest/api/2/group/user?groupname=mygroupname
Replace password" with the actual admin password.
Replace username" with the name of the user you're adding to the
group.
Replace myjiraserver.com with your JIRA server's FQDN.
Replace mygroupname with the name of the group to which you are
adding this user.
I added the --insecure option because of the private SSL certs used on my server. You may not need that, or you may not be using HTTPS at all (in which case edit the URL to use HTTP).