Speech recognition, batch processing, speech analytics, 404 [No such child resource] - ibm-cloud

I use the following url to access IBM's speech recognition batch processing via curl:
"https://api.us-east.speech-to-text.watson.cloud.ibm.com/v1/batches?function=recognize&timestamps=true&audio_metrics=true&model=en-US_NarrowbandModel&speech_analytics=true"
The files are in a COS bucket at us-geo. I get the following response:
{
"error": "No such child resource.",
"code": 404,
"code_description": "No Such Resource"
}
Any suggestions as to what resource is being referred to?
Thanks in advance for any guidance.
Cheers, Scott

The API signature that you are attempting to use matches the speech to text : customer care API, that according to the documentation at
https://cloud.ibm.com/apidocs/speech-to-text/speech-to-text-icp
The Speech to Text: Customer Care service is an on-premise solution
that is available only on IBM Cloud Private.
If that doesn't match your usage then the API you are attempting will not work.
If on the other hand it does match your usage then you need to submit a multi-part form with information locating the COS bucket holding your audio files.
EG.
curl -X POST -u "apikey:{apikey}" --header "Content-Type: multipart/form-data" --form input_credentials_file=#my_cos_credentials.json --form input_bucket_location=us-geo --form input_bucket_name=my_cos_input_bucket --form output_credentials_file=#my_cos_credentials.json --form output_bucket_location=us-geo --form output_bucket_name=my_cos_output_bucket "https://{icp_cluster_host}{:port}/speech-to-text/api/v1/batches?function=recognize&speech_analytics=true"

Related

How do you send an authorization header to a REST API from the copy task of an azure data factory pipeline?

I am trying to create an Azure data factory to copy data from an API to blob storage. The problem I'm encountering is getting the authorization to work. The API requires a token whose value we already have. The curl for the API is:
curl -X GET "https://zentracloud.com/api/v3/get_env_model_data/?device_sn=<value>&model_type=<value>&port_num=<value>
&inputs=<value>" -H "accept: application/json" -H "Authorization: Token <token>"
I've tried putting the Authorization into the auth headers of the Linked Service
and in the additional headers of the source of the Copy Data task
When I click "Preview Data" I get an "invalid credentials" error, which tells me either I'm not putting the authentication headers in the right place or my format is incorrect. I'm not sure how to get this thing to work.
I contacted Microsoft and was told that they don't support validation via a token.

GitHub API returning 404 although resource exists

I'm trying to send a POST request to the GitHub API to submit a comment on a commit.
According to the documentation, all that's needed (other than the URL params) is the body.
I have modified the example from the docs to the following:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/dchacke/test/commits/9b7413350932dd3f2906c0fdd26106c35c7ce450/comments \
-d '{"body":"test comment"}'
That should post a test comment to this commit. I know the commit and the owner and repo exist (it's my repo and I can see the commit under that URL), and yet I'm getting a 404 with the following response body upon submitting that API request:
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest/reference/repos#create-a-commit-comment"
}
The documentation makes no mention of authentication being required for that endpoint. A 404 doesn't exactly sound like an authentication problem, but just in case GitHub doesn't want to confirm the existence of repos/commits to unauthenticated users (though they do let them see those things on their website...), I tried setting a personal access token in an additional Authorization header in my CURL request. No dice.
What am I doing wrong?
Authentication was the issue after all. I had to make sure I used a token with the right privileges. In this case, it needed the public_repo privilege, which can be set up here.

Vimeo api returning specified resource not found, but video available through browser

I am able to view video through browser but when tried to get metadata for same using curl, I get below response
{
"error": "Something strange occurred. Please try again.",
"link": null,
"developer_message": "The specified resource doesn't exist.",
"error_code": 5000 }
Below is the curl url I am using.
curl -H "Authorization: bearer XXXX9eb82b84aX7XXXXXXca61eb3372" -H 'Accept: application/vnd.vimeo.user+json;version=3.0,application/vnd.vimeo.video+json;version=3.4' https://api.vimeo.com/videos/XXXXXXX
For some security reasons, I can not copy actual token or video id here. Hoping to get some help here.
Thanks
Maybe there is a problem with your access token, make sure it has the "private" scope

how to generate custom Auth token from api key

I am looking at the documentation at
[https://firebase.google.com/docs/reference/rest/auth/][1]
for how to exchange firebase id and refresh token with my API key.
In the documentation, I found the sample code and some explaination as below,
curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithCustomToken?key=[API_KEY]' \
-H 'Content-Type: application/json' \
--data-binary '{"token":"[CUSTOM_TOKEN]","returnSecureToken":true}'
In the example above, you would replace [API_KEY] with the Web API Key of your Firebase project, [CUSTOM_TOKEN] with the generated custom Auth token.
Anyone know how can I get the "custom Auth Token" as mentioned in the above sample?
Thanks
Think it is explained here: https://firebase.google.com/docs/auth/admin/create-custom-tokens
And if you need to cook up something yourself then specifically: https://firebase.google.com/docs/auth/admin/create-custom-tokens#create_custom_tokens_using_a_third-party_jwt_library

Cannot call the PayPal Sync API due to Authorization Failure

I'm trying to use the relatively new PayPal Sync API to download my PayPal transactions. I'm following the Sync API guide. I started by logging into the PayPal Developer Dashboard My Apps & Credentials page, scrolling to the REST API apps section, creating an app, clicking on it, and enabling Transaction Search for both the Sandbox and Live accounts.
I then used the Sandbox account's Client ID and Secret to generate an Access Token. I confirmed that the Client ID and Secret are correct and active. My cURL command is below (note that I'm using cURL on Windows 10):
curl -v https://api.sandbox.paypal.com/v1/oauth2/token ^
-H "Accept: application/json" ^
-H "Accept-Language: en_US" ^
-u "<my-client-id>:<my-secret>" ^
-d "grant_type=client_credentials"
I received a response similar to the following (I added the formatting):
{
"scope":"https://uri.paypal.com/services/reporting/search/read
https://api.paypal.com/v1/payments/.*
https://uri.paypal.com/services/applications/webhooks
openid",
"nonce":"2018-04-04T02:20:02Z...",
"access_token":"<my-access-token>",
"token_type":"Bearer",
"app_id":"<my-app-id>",
"expires_in":32400
}
I then took the Access Token and copied it into the sample command on the Sync API guide page. Here is the command I ran:
curl -v -X GET https://api.sandbox.paypal.com/v1/reporting/transactions?transaction_id=5TY05013RG002845M&fields=all&page_size=100&page=1 ^
-H "Content-Type: application/json" ^
-H "Authorization: Bearer <my-access-token>"
I received the following error response:
< HTTP/1.1 401 Unauthorized
...
< Content-Length: 244
< Connection: close
< Content-Type: application/json
<
{
"name":"AUTHENTICATION_FAILURE",
"message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.",
"links":[{
"href":"https://developer.paypal.com/docs/api/overview/#error",
"rel":"information_link"
}]
}
I tried many things to correct this error, including:
Adding a "Accept: application/json" and "Accept-Language: en_US" header to the command.
Creating a new Secret and generating a new Access Token.
Creating a new App with a new Client ID & Secret and generating a new Access Token.
Disabling Transaction Search, re-enabling it, and sending the command again.
Trying in the Live account.
Each of these attempts produced the same result. I noted that in the scope section of the access token response that it doesn't include a path similar to the stated path for the Sync API (/v1/reporting/transactions). However, that's just an observation, and I'm not sure if that is relevant.
I read through the entire Sync API guides and documentation about five times, and I searched Google and StackOverflow pretty thoroughly. I'm seeing evidence that some people are getting past the initial connection to Sync API, so I'm fairly certain this API works.
Can someone help me understand what I'm missing? Could it just be that I need to wait a day or two for their systems to catch up? PayPal's Developer documentation is not very user-friendly, and their Developer Dashboard is extremely glitchy.
I had this same issue. Putting double quotes around the URL solved it for me. The other API endpoints worked (authentication, authorizations/xyz) because they didn't have any special URL characters in them. In the transaction search, the query string delimiters were being parsed by Bash.
Your curl lines above become:
curl -v -X GET "https://api.sandbox.paypal.com/v1/reporting/transactions?transaction_id=5TY05013RG002845M&fields=all&page_size=100&page=1" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <my-access-token>"
Hope that helps someone.
It appears that this error may be caused by either cURL or the way I'm using it. On a hunch, I used Hurl.it to execute this sample request, and the request was successful (HTTP 200). I then tried another request where I searched for all transactions in a given date range, and that was also successful. I'm going to mark the question answered.