I'm fairly new To Parse with Rest Api
I wanna test samples in Their Webistes's ( Here ) in Postman But every time I Post it gives me following Authentication error :
I Wanna test following code in Postman ( see origin here )
curl -X POST \
-H "X-Parse-Application-Id: 0VoIZO8cgmnyfiuklLLkKkxOX7r" \
-H "X-Parse-REST-API-Key: UjU5eb5zjic75mPZVdHExYqnneT" \
-H "Content-Type: application/json" \
-d '{
"deviceType": "ios",
"deviceToken": "0123456789abcdef0123456789cdef0123456789abcdef",
"channels": [
""
]
}' \
https://api.parse.com/1/installations
How Can I resolve this issue ? What is that ? And What is required ?
You are reqeuesting GET request and api doc says its POST request.
1) Enter correct url and select POST request method. Add required headers as per the doc.
2) Enter raw JSON data in your request body.
3) You will receive your output. Since api key and application id is not valid so that I received unauthorized error.
Related
I am making a Zapier App that will contain a basic trigger. I am using REST hook in API configuration. I followed the instructed steps and everything is fine. At the End i get a Webhook URL, when i am creating a Zap.
As per my understanding, i will be using this URL to send POST request. So i use curl terminal command.
curl -X POST -H 'Content-type: application/json' --data '{ message: 'lemon', id: 'abc', season: 'summerTime' }' https://hooks.zapier.com/hooks/catch/7459492/XXXXXX/
I get response
{"id": "8e5bc4fb-a54c-4860-a22f-8896fadc95a1", "request_id": "5eb3c0c0-9a44-4543-81ba-87cd1a0793b0", "attempt": "5eb3c0c0-9a44-4543-81ba-87cd1a0793b0", "status": "success"}
But nothing happens.
This trigger is suppose to print message and season in some slack channel, i.e Zap i created.
Even in task log, no log is generated.
PS: when i do the same POST request with POSTMAN application, it works just
fine. Can anyone tell me what am i doing wrong.
I am new to these stuff.
I believe you're missing quotes around your keys in the data. Try this:
curl -X POST -H 'Content-type: application/json' --data '{ "message": "lemon", "id": "abc", "season": "summerTime" }' https://hooks.zapier.com/hooks/catch/7459492/XXXXXX/
Note that you can "copy as curl" from postman and emulate exactly what it's doing.
I have created IBM Speech to Text service. Then I have performed the trial call using the following IBM instructions:
Try an API call
Call the POST /v1/recognize method to request a basic transcription of
a FLAC audio file with no additional request parameters.
First, download the sample audio file audio-file.flac.
Then, issue the following command to call the service's /v1/recognize
method for basic transcription with no parameters. The example uses
the Content-Type header to indicate the type of the audio, audio/flac.
The example uses the default language model, en-US_BroadbandModel, for
transcription. Be sure to modify {path_to_file} to specify the
location of the audio-file.flac file.
curl -X POST \
-u "apikey:{apikey}" \
--header "Content-Type: audio/flac" \
--data-binary #{path_to_file}audio-file.flac \
"{url}/v1/recognize"
The service returns the following transcription results:
{
"results": [
{
"alternatives": [
{
"confidence": 0.8691191673278809,
"transcript": "several tornadoes touch down as a line of severe thunderstorms swept through colorado on sunday"
}
],
"final": true
}
],
"result_index": 0
}
I have tried execute this substituting my STT service credentials, but I received error message instead of transcript result:
<HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY>
An error occurred while processing your request.<p>
Reference #179.24f01502.1545478256.101ee90d
</BODY></HTML>
I have tried different {path_to_file} variants - using slashes /, backslashes \ and double backslashes \ \ but all of them returned the same error. What's wrong with my request or my STT service?
Check the location of your service - this error occures when you mix up the service urls. For example creating the service in Frankfurt
with this API URL https://stream-fra.watsonplatform.net/speech-to-text/api/v1/recognize and calling the service using the London location gateway-lon
curl -X POST \
-u "apikey:APIKEY" \
--header "Content-Type: audio/flac" \
--data-binary #audio-file.flac \
"https://gateway-lon.watsonplatform.net/speech-to-text/api/v1/recognize"
the error occures. It should probably return something like {"code":401, "error": "Unauthorized"}.
I am trying to stop a running server instance on Openstack Nova. I am using the following API as a reference
https://developer.openstack.org/api-ref/compute/#stop-server-os-stop-action
The following is my code snippet
import openstack.config
self.cloud_region = openstack.config.OpenStackConfig().get_one('adminproject')
self.session = self.cloud_region.get_session_client('compute')
I am able to make GET requests to the server
response = self.session.get(url)
But when i try to make POST requests, I am getting errors. This is how I am trying to do it
url = "/servers/" + vm_id + "/action
body = {"os-stop":"null"}
reponse = self.session.post(url, {'os-stop' : 'null'})
TypeError: post() takes exactly 2 arguments (3 given)
I have also tried
reponse = self.session.post(url, body=body)
which gives me an error
TypeError: request() got an unexpected keyword argument 'body'
When i do it via the nova client and enable the debug mode, this is what i get
curl -g -i -X POST http://IP:PORT/v2.1/12bf80bc27cf4fdc87a2ce2cb0619159/servers/93bc82d4-7a3b-4f67-bc6e-dfb2553a57fc/action -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Token: {SHA1}447e97116c71efcff1a02f4d7fdf8d76a4490d9d" -d '{"os-stop": null}'
It would be great if someone can help in finding out how to emulate the above request.
TIA.
I am trying to follow the documentation from timekit.io. I am attempting to do something as simple as send a curl request to do basic authentication as seen in this section of the docs. I have replaced the Timekit-App:name-of-app with the name of my app which I found in the app-settings of my timekit account. I also replaced the email & password with the one's I use to login into my account.
I simply copied and pasted the curl command as is into my terminal and I get a response that says {"error":"Content-type should be json!"} I am not sure if I am not supposed to copy and paste it as is, or what I may be doing wrong, but my understanding is I am supposed to get a json response with a email and a api token among some other data.
Here is my curl command.
curl -X POST \
-H 'Timekit-App: jl-fit' \
-d '{
"email": "email#email.com",
"password": "password"
}' \
https://api.timekit.io/v2/auth
Looks like you have discovered a bug in their docs/examples.
The API you're connecting to expects JSON content type, but curl by default (for POSTing data) uses application/x-www-form-urlencoded. You can fix it by adding the header field explicitly with: -H 'Content-Type: application/json'.
Also, when you use the -d/--data option, method defaults to POST, so it doesn't have to be specified explicitly.
All put together, this should work:
curl \
-H 'Content-Type: application/json' \
-H 'Timekit-App: jl-fit' \
-d '{"email": "email#email.com", "password": "password"}' \
"https://api.timekit.io/v2/auth"
When having multiple arguments, it can be convenient to keep them in an array (no need to escape newlines). For example:
args=(
-H 'Content-Type: application/json'
-H 'Timekit-App: jl-fit'
-d '{"email": "email#email.com", "password": "password"}'
"https://api.timekit.io/v2/auth"
)
curl "${args[#]}"
I try to lock a file via the API BOX but I encounted issue.
I use the code provided the api documenation (https://developers.box.com/docs/ Lock and Unlock section) but the code does not work.
curl https://api.box.com/2.0/files/xxxxxx\
> -H "Authorization: Bearer xxxxxx" \
> -d "lock": null \
> -X PUT
and the return of the API:
{"type":"error","status":400,"code":"bad_request","context_info":{"errors":[{"reason":"invalid_parameter","name":"entity-body","message":"Invalid value 'lock:'. Entity body should be a correctly nested resource attribute name\/value pair"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Bad Request","request_id":"xxxxxxxxx"}curl: (6) Couldn't resolve host 'null'
I did the test by trying to locke a file : same problem.
Several questions:
Is that the lock function has already work? Do you know if box has
changed its code ?
Any help is welcome :)
Nicolas
I had an answer by Suppor team :
There was a typo in the docs. Please try the command again:
Lock:
curl https://api.box.com/2.0/files/FILE_ID
-H "Authorization: Bearer ACCESS_TOKEN"
-d '{"lock": {"type": "lock","expires_at": "2015-12-12T10:55:30-08:00","is_download_prevented": false}}'
-X PUT
Unlock:
curl https://api.box.com/2.0/files/FILE_ID
-H "Authorization: Bearer ACCESS_TOKEN"
-d '{"lock": null}'
-X PUT
https://support.box.com/hc/fr/requests/793456?flash_digest=c5350d2f104f3066b46cb83baa97c23dac863d2b