I have openIdm ForgeRock installed locally and I'am trying to go through the API Explorer etc. in order to see how to use the endpoints and the available endpoints.
From localhost:8080 where ForgeRock is running I can run/try a request. It works fine and I see the Response with Status 200 and its details.
When I try same Request URL on Postman, I get:
{
"code": 401,
"reason": "Unauthorized",
"message": "Access Denied"
}
In a way this makes sense for me as I'am not logged in in this case as directly via ForgeRock Server on localhost:8080. So how can I work around this to be able to run my tests also on Postman.
I tried the parameters username=xxx and password=xxx to the Request on Postman, but it keeps throwing the same error.
I also tried it on Postman as CURL request exactly how ForgeRock is using it, but it seems to have an issue with Authorization.
curl -X GET --header 'Accept: application/json' --header 'X-Requested-With: Swagger-UI' 'http://localhost:8080/openidm/managed/user?_queryId=query-all'
Any Idea please?
Fixed. Was actually simple... Had to add the following in the headers:
X-OpenIDM-Username
X-OpenIDM-Password
Value is by default: opendidm-admin for both.
Related
I was following the steps mentioned in the documentation for django rest framework.
I'm not able to proceed from step 4.
As mentioned in the documentation,
curl -X POST -d "grant_type=password&username=<user_name>&password=<password>" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/
I have changed the above variables with my values.
curl -X POST -d "grant_type=password&username=admin&password=admin123" -u "5hKeHNtF3EKy3uCpJqaAe3mU2bGZTgJhsKKxIuAQ:pbkdf2_sha256$390000$VFcCOjIZkBFObellddDgKA$DXovC1UiuxRQ0KN/lARIdQmXcj8dnoJofkznmkkqsZY=" http://localhost:8000/o/token/
I tried to import the curl on postman and Im getting this error
Then I tried running the curl on Insomnia testing tool, and I got the request configured as in the screenshot.
Then I click send and I got an error
SO i changed 'Content-Type' to 'Form URL Encoded'
Now I'm geting an error
{
"error": "invalid_client"
}
I tried running the curl in shell also, and I'm getting an invalid syntax error
I'm stuck with this and don't know how to proceed with this. Please lend me a hand.
Thanks in advance...
I was using the hashed value for client_secret instead of the actual value.
How to get actual client_secret actual value?
Answer:
While creating new application, copy the Client secret before saving
the values
https://github.com/jazzband/django-oauth-toolkit/issues/1193
I am setting up WSO2-AM and uploading an API's servicedefinition swagger.json but upon trying the service in WSO2-AM, I get the response in FireFox "TypeError: NetworkError when attempting to fetch resource.". In Chrome its response is "TypeError: Unable to fetch".
The server is informationproxy.com and has SSL configured. Looks fine having a green lock in the urlbar with trusted certificate-chain. It does not certify for using the ip-number "https://209.182.203.81:9443/store/"
Question is: what makes WSO2 respond (in FireFox) with "TypeError: NetworkError when attempting to fetch resource."
The service does not seem to be the problem, since it works fine in editor.swagger.io.
The service also works fine directly called from curl to the external serviceprovider, returning a valid JSON with the data I expect:
curl -k -X GET "https://tieka.nl/webservices/address/luxembourg/v1/?postcode=8080&number=1" -H "accept: application/json"
Also: all other api-services that I have tried to implement fail with the same error message.
There is a side-effect. The response to this curl is an encrypted payload:
curl -k -X GET "https://209.182.203.81:8243/webservices/address/luxembourg/v1/?postcode=8080&number=1" -H "accept: application/json" -H "Authorization: Bearer a1111111-1aa1-1111-aaaa-1111aaaa1111"
<ns:binary xmlns:ns="http://ws.apache.org/commons/ns/payload">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9JRVRGLy9EVEQgSFRNTCAyLjAvL0VOIj4KPGh0bWw+PGhlYWQ+Cjx0aXRsZT4zMDEgTW92ZWQgUGVybWFuZW50bHk8L3RpdGxlPgo8L2hlYWQ+PGJvZHk+CjxoMT5Nb3ZlZCBQZXJtYW5lbnRseTwvaDE+CjxwPlRoZSBkb2N1bWVudCBoYXMgbW92ZWQgPGEgaHJlZj0iaHR0cHM6Ly93d3cudGlla2Eubmw6ODAvd2Vic2VydmljZXMvYWRkcmVzcy9sdXhlbWJvdXJnL3YxLz9wb3N0Y29kZT04MDgwJmFtcDtudW1iZXI9MSI+aGVyZTwvYT4uPC9wPgo8aHI+CjxhZGRyZXNzPkFwYWNoZSBTZXJ2ZXIgYXQgd3d3LnRpZWthLm5sIFBvcnQgODA8L2FkZHJlc3M+CjwvYm9keT48L2h0bWw+Cg==</ns:binary>
I'd like to be able to make a speech:recognize request on and with my own cloud-hosted resources, so I can simply log into the Google Cloud Platform console, run a command in the Cloud Shell, and see the results. Much like https://cloud.google.com/speech-to-text/docs/quickstart-protocol, except without making use of anything locally.
Not sure what other important info to share, but the .json and .flac files in my cloud have public read access.
How can I achieve this?
my request:
curl -H "Content-Type: application/json" https://speech.googleapis.com/v1/speech:recognize?key=[my-api-key] -d #https://storage.googleapis.com/[bucket]/[json-request-filename].json
the response:
Warning: Couldn't read data from file
Warning: "https://storage.googleapis.com/[bucket]/[json-request-filename].json",
Warning: this makes an empty POST.
{
"error": {
"code": 400,
"message": "RecognitionAudio not set.",
"status": "INVALID_ARGUMENT"
}
}
here's the .json hosted in google cloud storage:
{
"config": {
"encoding":"FLAC",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"enableWordTimeOffsets": false
},
"audio": {
"uri":"gs://[bucket]/[audio-filename].flac"
}
}
No new info, but here's how it all looks the Google Cloud Platform Shell:
[my-account]#cloudshell:~ ([my-project])$ curl -H "Content-Type: application/json" https://speech.googleapis.com/v1/speech:recognize?key=[my-api-key] -d #https://storage.googleapis.com/[bucket]/[json-request-filename].json
Warning: Couldn't read data from file
Warning: "https://storage.googleapis.com/[bucket]/[json-request-filename].json",
Warning: this makes an empty POST.
{
"error": {
"code": 400,
"message": "RecognitionAudio not set.",
"status": "INVALID_ARGUMENT"
}
}
The -d flag in the curl command tells curl to read data from the filename right after it, and use that data as the body of the request. curl does not recognize a web URL as a valid file. curl can't read that JSON file, so it acts as if it were an empty file, and builds a request with an empty body. The request that's sent to the API doesn't have any information about that JSON file.
The speech API receives the request with an empty body, and can't do anything with it. The API doesn't even know that you specified a Google Cloud object in the curl command.
The speech:recognize method is documented at https://cloud.google.com/speech-to-text/docs/reference/rest/v1p1beta1/speech/recognize. It does not have any way to get the parameters it needs except from the body of the request. You can't tell it to go read those parameters from somewhere else, such as a URL or Google Cloud object. You have to include them in the request, so the program that builds the request needs to know them.
You can find your API key using the following code but you have to install gcloud using this link https://cloud.google.com/sdk/docs/install#linux
gcloud auth application-default print-access-token
curl -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json; charset=utf-8" --data "{
'input':{
'text':'I\'ve added the event to your calendar.'
},
'voice':{
'languageCode':'en-gb',
'name':'en-GB-Standard-A',
'ssmlGender':'FEMALE'
},
'audioConfig':{
'audioEncoding':'MP3'
}
}" "https://texttospeech.googleapis.com/v1/text:synthesize"
Wso2 API Manager 1.10.0. PUT method does not work in API store.
GET, POST, DELETE methods work, but PUT dose not work.
Error,
Curl
curl -X PUT --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer c6c90338514e561c8a02a7b6a1c96553" -d "{\"payment\":\"PAID\"}" "https://10.138.31.22:8243/Starbucks_API/1/order_1"
Request URL
https://10.138.31.22:8243/Starbucks_API/1/order_1
Response Body
<ams:fault xmlns:ams="http://wso2.org/apimanager/security">
<ams:code>900906</ams:code>
<ams:message>No matching resource found in the API for the given request</ams:message>
<ams:description>Access failure for API: /Starbucks_API/1, version: 1. Check the API documentation and add a proper REST resource path to the invocation URL</ams:description>
</ams:fault>
Response Code
403
Response Headers
{
"content-type": "application/xml; charset=UTF-8"
}
Resource given in the request is actually matching, which I mentioned in API.
Any help is appreciated.
Resource Definition
You are having two PUT with same URL. You can't have two different HTTP resource with same URL.
This question is regarding REST API URL for use with curl equivalent to VMC push for a new application.
I have referred the api documentation of cloud foundry at http://apidocs.cloudfoundry.com/http-apps for various REST API URL mapping to vmc commands. However, I did not find a REST API URL for pushing a new application. I have tried deploying a new application with the POST html request but that returns a 504 BAD GATEWAY response. below is the curl command:
curl --request POST http://api.cloudfoundry.com/apps --data #data.json --header "Authorization: bearer token"
Content of data.json are as follows:
{"name": "mywebapp45", "staging": {"model": "spring","stack": "java"}, "uris": [ "mywebapp45.cloudfoundry.com"], "instances": 1, "resources": {"memory": 256},"state": "STARTED"}`
and the web app archive is in the same directory from where I execute the curl command.
Any insight on this is much appreciated. Thanks a lot for the help in advance
Based on the language, I'd like you to try the cfoundry ruby client: rubygems.org/gems/cfoundry, the java client: github.com/cloudfoundry/vcap-java-client, or the Node.js client which can also be found in github.