google speech api response is empty, even with this example test - google-api

When I run the API explorer from this page i get a 200 OK response, but the response json doesn't have any transcription. What am i doing wrong?
API Explorer location:
https://cloud.google.com/speech/reference/rest/v1/speech/longrunningrecognize
Request parameters:
Default
Request body:
{
"config": {
"encoding": "FLAC",
"languageCode": "en-US",
"sampleRateHertz": 16000
},
"audio": {
"uri": "gs://cloud-samples-tests/speech/brooklyn.flac"
}
}
Response:
{
"name": "3497944051092250866"
}

i figured it out.
with longrunningrecognize you get back the name object and then you have to send a operations.get to retrieve your processed object.
this is explained here beautifully
https://medium.com/towards-data-science/tutorial-asynchronous-speech-recognition-in-python-b1215d501c64

Related

Are batch json-rpc requests not supported with near?

When trying to batch json rpc requests like this:
[
{
"jsonrpc":"2.0",
"id":"46500000",
"method":"block",
"params":{
"block_id": 46500000
}
},
{
"jsonrpc":"2.0",
"id":"46500001",
"method":"block",
"params":{
"block_id": 46500001
}
}
]
The response given is this:
{
"jsonrpc": "2.0",
"error": {
"name": "REQUEST_VALIDATION_ERROR",
"cause": {
"name": "PARSE_ERROR",
"info": {
"error_message": "JSON RPC Request format was expected"
}
},
"code": -32700,
"message": "Parse error",
"data": "JSON RPC Request format was expected"
},
"id": null
}
This is quite confusing since the above request is a valid jsonrpc request according to the spec. Are batch requests not supported on near?
You are right, batch JSON RPC requests are not supported by nearcore JSON RPC implementation. Batch JSON RPC requests can become arbitrary heavy. It is preferred to leverage load balancer to get several requests resolved, so just make separate calls instead of batching them.
I wonder what is your use-case, though. Maybe you want to take a look into Indexer Framework

Teams is not displaying my unfurl response

I have a Teams integration with link unfurling set up. I have the messaging endpoint pointed to a public ngrok URL and ngrok proxying a local node.js server that returns the example payload Microsoft has in it's documentation.
This is my endpoint (express.js):
app.post('/bot-test', (req, res) => {
res.send({
"composeExtension": {
"type": "result",
"attachmentLayout": "list",
"attachments": [
{
"contentType": "application/vnd.microsoft.teams.card.o365connector",
"content": {
"sections": [
{
"activityTitle": "[85069]: Create a cool app",
"activityImage": "https://placekitten.com/200/200"
},
{
"title": "Details",
"facts": [
{
"name": "Assigned to:",
"value": "[Larry Brown](mailto:larryb#example.com)"
},
{
"name": "State:",
"value": "Active"
}
]
}
]
}
}
]
}
});
});
When I post a URL in a message in Teams, I see it POST to that endpoint and it responds without errors, but nothing shows up in Teams. What's going wrong? I can't find any logs on Microsoft's side either. I would expect that Teams renders a card with the response payload.
Office 365 Connector cards are not supported for link unfurls ("Message extension previews" in MS parlance). Changing the response to a supported card type worked. Unfortunately, MS doesn't surface this problem anywhere and it just silently discards the response. I was able to find a somewhat useful error description by inspecting the network request that went out from the Teams web client, however.
See this for supported card types: https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference

graphql-mesh: why odata handler throws error when serving my local endpoint

I am trying to follow the example in the GraphQL-Mesh and replace the endpoint with my own to see how it works. Default github example works however when I try to server the mesh for my example, it throws the following error:
$ "C:\Kiran\example\GraphQLMesh\node_modules\.bin\graphql-mesh" serve
Debugger listening on ws://127.0.0.1:64627/889629dc-8f00-446e-8927-5bdcd2791e10
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
(node:13408) ExperimentalWarning: The fs.promises API is experimental
error: Unable to serve mesh: Cannot read property 'concat' of undefined {"stack":"TypeError: Cannot read property 'concat' of undefined\n at schemas.forEach (C:\\Kiran\\example\\GraphQLMesh\\node_modules\\#graphql-mesh\\odata\\index.cjs.js:493:51)\n at Array.forEach (<anonymous>)\n at ODataHandler.getMeshSource (C:\\Kiran\\example\\GraphQLMesh\\node_modules\\#graphql-mesh\\odata\\index.cjs.js:471:67)\n at process._tickCallback (internal/process/next_tick.js:68:7)"}
Waiting for the debugger to disconnect...
Done in 9.93s.
Waiting for the debugger to disconnect...
my .meshrc.yaml is very simple as shown below
sources:
- name: Mytest
handler:
odata:
baseUrl: http://localhost:6001/odata/v1/
batch: multipart
expandNavProps: true
serve:
exampleQuery: northwind-example.graphql
and package.json also is just copy of what is in the github
{
"name": "odata-example",
"version": "0.7.30",
"license": "MIT",
"private": true,
"scripts": {
"start": "graphql-mesh serve"
},
"dependencies": {
"#graphql-mesh/cli": "^0.12.1",
"#graphql-mesh/odata": "0.7.1",
"graphql": "^15.4.0"
}
}
When I hit the odata endpoint (http://localhost:6001/odata/v1/) on Postman, I see the following response:
Header
Status Code: 200 OK
content-type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
date: Sat, 05 Dec 2020 06:52:51 GMT
odata-version: 4.0
server: Kestrel
transfer-encoding: chunked
Response
{
"#odata.context": "http://localhost:6001/odata/v1/$metadata",
"value": [{
"name": "Products",
"kind": "EntitySet",
"url": "Products"
}, {
"name": "Categories",
"kind": "EntitySet",
"url": "Categories"
}, {
"name": "Suppliers",
"kind": "EntitySet",
"url": "Suppliers"
}]
}
My example query is also very simple as shown below:
query fetchCatagories {
myCatagories {
CategoryId
CategoryName
Description
Products {
ProductName
OrderDetails {
OrderId
}
}
Catagories(queryOptions: { top: 1 }) {
Description
}
}
}
What am I missing in my example to get the mesh working and generating the GraphQL endpoint?
Also do I really need an example.graphql for OData as any OData service will have /$metadata endpoint that exposes the schema?
Update 1
Also I cannot get this to work with public odata endpoint like https://services.odata.org/V3/OData/OData.svc/
only the default example endpoints work
https://graph.microsoft.com/${GRAPH_VERSION:v1.0}
https://services.odata.org/TripPinRESTierService/(S(qzsyox3345c15qeq305pblvw))/
What is going on here?
if you run in to this issue, its a bug in the odata module and PR fix is available here

Problem with create team with Microsoft Graph Api

I have a problem with creating teams using the Microsoft Graph Api. I can get/create groups but when I try to get/create teams I get an error. I'm using postman and the group has owners and members, just as the documentation of MS, also has the permissitions it asks for groups. If somebody can help me, cause I look everywhere for a same error but no found it.
PUT https://graph.microsoft.com/v1.0/groups/{id}/team
Headers: Authorization: bearer token and content-type: json
Body is
{
"memberSettings": {
"allowCreateUpdateChannels": true
},
"messagingSettings": {
"allowUserEditMessages": true,
"allowUserDeleteMessages": true
},
"funSettings": {
"allowGiphy": true,
"giphyContentRating": "strict"
}
}
I always get the same error
{
"error": {
"code": "BadGateway",
"message": "Failed to execute backend request.",
"innerError": {
"request-id": "45eeba8a-9d35-45e8-b42e-c60da7a47dde",
"date": "2020-01-23T21:55:44"
}
}
}
According to the Graph API docs for this, you're not calling the correct endpoint to create a new Team. It should be
POST https://graph.microsoft.com/beta/teams
and a payload similar to
Content-Type: application/json
{
"template#odata.bind": "https://graph.microsoft.com/beta/teamsTemplates('standard')",
"displayName": "My Sample Team",
"description": "My Sample Team’s Description",
"owners#odata.bind": [
"https://graph.microsoft.com/beta/users('userId')"
]
}
Note that it's slightly different, as per the docs, whether you're using delegated versus application permissons.

GoCardless API using Classic ASP

I'm creating the following request in vbscript and sending to the gocardless sandbox:
url="https://api-sandbox.gocardless.com/"
typ="GET"
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")
xml.Open typ, url, False
xml.setRequestHeader "Authorization", "Bearer " & GCAccessToken
xml.SetRequestHeader "GoCardless-Version", "2015-07-06"
xml.SetRequestHeader "Accept","application/json"
xml.SetRequestHeader "Content-Type", "application/json"
xml.Send
GetGC = xml.responseText
Set xml = Nothing
The response I always get despite any tweaks I do is:
{"error":{"message":"not found","errors":[{"reason":"not_found","message":"not found"}],"documentation_url":"https://developer.gocardless.com/api-reference#not_found","type":"invalid_api_usage","request_id":"0AA4000DECCD_AC121CEB1F90_5BE18701_19AD0009","code":404}}
Any help would be appreciated. Have successfully done similar for Stripe but now need to use GC.
If you read the response from the API
{
"error": {
"message": "not found",
"errors": [{
"reason": "not_found",
"message": "not found"
}
],
"documentation_url": "https://developer.gocardless.com/api-reference#not_found",
"type": "invalid_api_usage",
"request_id": "0AA4000DECCD_AC121CEB1F90_5BE18701_19AD0009",
"code": 404
}
}
The error appears to be a HTTP status code (as is common with RESTful APIs) - 404 Not Foundlooking at the documentation link provided in the response;
404
Not Found. The requested resource was not found or the authenticated user cannot access the resource. The response body will explain which resource was not found.
So the issue could be;
You have failed to authenticate using the token in the code provided.
You authenticated but don't have permission to access the resource.
The resource you are looking for does not exist.
In this particular instance, I would suggest it is because the resource doesn't exist as the code doesn't specify a resource, only the base URL of the API which won't constitute an API endpoint you can interact with.
Looking at the documentation it's clear you need to provide a valid endpoint in the URL, at the time of writing there are 15 core endpoints to interact with along with 2 helper endpoints.
For example, a create payment request/response would look like;
POST https://api.gocardless.com/payments HTTP/1.1
{
"payments": {
"amount": 100,
"currency": "GBP",
"charge_date": "2014-05-19",
"reference": "WINEBOX001",
"metadata": {
"order_dispatch_date": "2014-05-22"
},
"links": {
"mandate": "MD123"
}
}
}
HTTP/1.1 201 (Created)
Location: /payments/PM123
{
"payments": {
"id": "PM123",
"created_at": "2014-05-08T17:01:06.000Z",
"charge_date": "2014-05-21",
"amount": 100,
"description": null,
"currency": "GBP",
"status": "pending_submission",
"reference": "WINEBOX001",
"metadata": {
"order_dispatch_date": "2014-05-22"
},
"amount_refunded": 0,
"links": {
"mandate": "MD123",
"creditor": "CR123"
}
}
}
Unfortunately, the code sample provided in the question doesn't really do anything so it's difficult to suggest what you are trying to do. In conclusion, I would suggest re-visiting the documentation for the API and look through the samples provided.

Resources