Format for PIN Code - nest-api

In developing to the Nest Cloud API I've tested access using my developer pin code. The pin code is alpha-numeric and my question is:
During the authorization with the pin code, is the evaluation case insensitive or sensitive?
I.e. is 33HV7900 the same as 33hv7900?

Based on experimentation the :pin_code URL parameter in the CURL request below seems to produce an API access token regardless of case:
Request:
curl -X POST -H "Content-Type: application/json" 'https://api.home.nest.com/oauth2/access_token?client_id=:product_id&code=:pin_code&client_secret=:secret&grant_type=authorization_code'
Response:
{
"access_token": "my_token_here",
"expires_in": 315360000
}
I have obfuscated values in both the Request & Response.

Related

Retrieve Access Token for Quire API - unsupported_grant_type

I am attempting to Retrieve Access Token following the directions in the api docs (https://quire.io/dev/api/)
Example curl request
curl -H "Content-Type: application/json" -X POST -d '{"grant_type":"authorization_code","code":"my_code","client_id":"my_client_id","client_secret":"my_client_secret"}' https://quire.io/oauth/token
I only receive this response:
{"error":"unsupported_grant_type","error_description":"The supported grant types are 'authorization_code', 'refresh_token'."}
Can you see anything wrong with my curl request?
by Anderson Reinkordt
sounds like a duplicate of: Exchange Quire authorization code for access token with GM_xmlhttpRequest
Explained/accepted in this response: https://stackoverflow.com/a/58370352/4740707
Since the error message is a bit misleading please vote for:
https://github.com/quire-api/quire-api/issues/9

401 Unauthorized when trying to grab playlists using Spotify API

I've pulled a client_credentials token and while I can access other parts of the API, I can't seem to pull playlist information. It's definitely a public playlist, yet I'm getting 401 Unauthorized. Am I just misunderstanding something?
Edit
For example, this works:
puts curl -I -s -X GET "https://api.spotify.com/v1/users/#{testUser}" -H "Authorization: Bearer {#{#accessToken}}"
This does not:
puts curl -I -s -X GET "https://api.spotify.com/v1/users/#{testUser}/playlists/#{testPlaylist}?fields=href,name,owner(!href,external_urls),tracks.items(added_by.id,track(name,href,album(name,href)))" -H "Authorization: Bearer {#{#accessToken}}"
Are you sure you are sending the credentials cookie as part of your request? If you're not sure, you can use Wireshark or a similar tool to see the details of your request.
Edit: Relevant doc, but you've probably already seen this:
https://developer.spotify.com/web-api/get-playlist/

Azure: Parameter 'requestid' value is invalid

I'm trying to use the Microsoft Speech API as documented here: https://www.microsoft.com/cognitive-services/en-us/Speech-api/documentation/GetStarted/GetStarted-cURL
I have a key and I authenticate fine. When I try to use the service I get this error:
Parameter 'requestid' value '1234844532343434' is invalid.
I've tried different types of numbers and strings with no luck. What format is Azure looking for in requestid?
My test script looks like this:
token="..."
requestid="1234844532343434"
curl -v -X POST "https://speech.platform.bing.com/recognize?scenarios=smd&appid=D4D52672-91D7-4C74-8AD8-42B1D98141A5&locale=your_locale&device.os=your_device_os&version=3.0&format=json&instanceid=your_instance_id&requestid=${requestid}" -H "Authorization: Bearer ${token}" -H 'Content-type: audio/wav; codec="audio/pcm"; samplerate=16000' --data-binary #man1_nb.wav
Based on the documentation here, the requestid parameter's value should be a GUID.
Please try using that.

Hybris API Command example usage for creating a customer

I am somewhat new to the Hybris API, and how to work with it, and so, I am trying to experiment with creating a new customer, called “Jolly Rodgers”…
I am trying to create a customer for the Hybris Accelerator Store “apparel-de”, but I do not seem to be getting the correct response:
With this:
a. I am using a REST Client.
b. I retreieve the authorization token and get:
c. I get the response:
{
"access_token": "0da83a86-6dd6-4526-a233-3d947b9040c1",
"token_type": "bearer",
"expires_in": 36000
}
d. I next attempt to create a new customer using the Hybris/OCC commands, using the following:
curl -X POST -H "Authorization: bearer 0da83a86-6dd6-4526-a233-3d947b9040" -H "Accept: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: b156f52b-4b43-ec3d-44ea-d98a48410dc7" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" http://localhost:9001/rest/v1/apparel-de/customers?login=jolly.rodgers#mail.com&password=password1&firstName=Jolly&lastName=Rodgers&titleCode=mr
I get a message indicating that it could not get any response… any suggestions???
why are you using OCC for Creating Customer?
traditional way is to use HMC. HMC > Users

Square Connect can't subscribe to webhook notifications

I am following the instructions here on setting up webhook notifications for Square payments. But when I execute the curl statement in step 5 to subscribe to my own merchant's payment notifications, I get the response:
{"type":"bad_request","message":"Request body is not an array of event types"}
The curl statement is
curl -X PUT -H "Authorization: Bearer MY_ACCESS_TOKEN" -d '{"event_types": ["PAYMENT_UPDATED"]}' https://connect.squareup.com/v1/me/webhooks
Did they update the event type names? I can't find any other documentation on webhooks.
Whoops! Thanks for catching this error in the blog post, which I have now corrected. The format of the curl previously shown in step 5 had two errors:
The request body should simply have been the array of desired event types, such as:
["PAYMENT_UPDATED"]
With no JSON object surrounding it. The correct format is also shown in the API documentation.
The request was missing a Content-Type: application/json header. All requests to Connect API endpoints require this header.
The correct request looks like this, with your personal access token substituted where indicated:
curl -X PUT -H "Authorization: Bearer PERSONAL_ACCESS_TOKEN" -H "Content-Type: application/json" -d "[\"PAYMENT_UPDATED\"]" https://connect.squareup.com/v1/me/webhooks

Resources