How to create transaction for shopify order created via API - rest

I have followed everything in the following shopify question which is basically the same thing but what is described there is not working for me at all. Here is the request I am sending to the transactions endpoint:
{
"transaction": {
"amount": "0.01",
"kind": "sale"
}
}
and here is the response I am getting:
{
"errors": {
"kind": [
"sale is not a valid transaction"
]
}
}
I am thinking something has changed with shopify's API since that seemingly duplicate question was answered.

Related

Kinesis Stream - API Gateway: Serialization Exception

I am integrating Kinesis Stream with API Gateway following this tutorial.
The records endpoint uses the PutRecords action. The expected request template for this endpoint is the following:
{
"StreamName": "$input.params('stream-name')",
"Records": [
{
"Data": "$util.base64Encode($elem.data)",
"PartitionKey": "$input.path('$.PartitionKey')"
}#if($foreach.hasNext),#end
]
}
Despite following the tutorial exactly as it is, if I send a Request body with the expected format such as the next one, I get a SerializationException error:
{
"StreamName": "my_kinesis_stream",
"Records": [
{
"Data": "XzxkYXRhPl8x",
"PartitionKey": "partitionKey1"
},
{
"Data": "f1PxFQo92Afh",
"PartitionKey": "partitionKey1"
},
{
"Data": "Gi4sEdd08HypA",
"PartitionKey": "partitionKey1"
}
]
}
I don't know if the template of the tutorial is the right one or if my body request has not the proper format.
Oddly, all the other endpoints of the tutorial work just fine. This is the only one not working properly.
Thanks in advance.
The documentation actually was wrong. This documentation specifies the correct request template:
{
"StreamName": "$input.params('stream-name')",
"Records": [
#foreach($elem in $input.path('$.records'))
{
"Data": "$util.base64Encode($elem.data)",
"PartitionKey": "$elem.partition-key"
}#if($foreach.hasNext),#end
#end
]
}

Is there a way to reply to pull-request review comments with the Github-API V4 (GraphQL)?

Goal
I want to use the GraphQL API to reply to a pull request review comment.
It is possible if the status of the review is PENDING, but when the status of the review is SUBMITTED, it is not possible.
When I try it over the UI or the API V3 (REST), everything works fine.
This is an example of an reply to another PR-review comment.
This was the way to do it over the REST API.
What I have tried
I have tried to use the GraphQL addPullRequestReviewComment
mutation.
Here is my mutation request
mutation {
addPullRequestReviewComment(
input: {
pullRequestReviewId: $pullRequestReviewId,
inReplyTo: $commentToReplyTo,
body: "test comment"
}) {
clientMutationId
comment{
body
}
}
}
I expect the above mutation to reply to another review comment, but I get this response:
{
"data": {
"addPullRequestReviewComment": null
},
"errors": [
{
"type": "VALIDATION",
"path": [
"addPullRequestReviewComment"
],
"locations": [
{
"line": 2,
"column": 3
}
],
"message": "Review has already been submitted."
}
]
}
I know that when you reply to another PR-Review comment of an already submitted review, you create a new review object for that comment.
But when I would try to solve my problem with that logic I would expect to find a reply_to field or some other way to link to a comment of another PR-review comment on the addPullRequestReviewInput object.

Google Classroom Rest API Patching 'text' in announcement does not work

When we try to patch 'text' in a Google Classroom announcement using REST API we get an error. If we remove 'text' from the updateMask, it works. Others have also reported this, but there is no answer. Here are the details:
Request URL: https://classroom.googleapis.com/v1/courses/xxxxxxx2746/announcements/xxxxxxx8639?updateMask=text,state
Request Method: PATCH
Payload:
{text: "Live Session at 1/31/2019", state: "PUBLISHED"}
Response:
Status Code: 400
Remote Address: 172.217.15.106:443
{
"error": {
"code": 400,
"message": "updateMask: Non-supported update mask fields specified",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "updateMask",
"description": "Non-supported update mask fields specified"
}
]
}
]
}
}
Unfortunately, this is a bug in the Classroom API right now. The best workaround right now is to delete and re-create the post with the announcements.delete and announcements.create endpoints. You can keep track of the progress of the bug here.

Error "Empty speech response"

I tried to connect DialogFlow and Actions on Google, so I created some intents, connected the services, added explicit and implicit invocations etc, but when I try the bot in the simulator https://console.actions.google.com/project/[projectId]/simulator/ it always gives me the error:
"Failed to parse Dialogflow response into AppResponse, exception
thrown with message: Empty speech response"
even tough inputType was "KEYBOARD".
What I tried so far:
I did set "Response from this tab will be sent to the Google Assistant integration" in Dialog Flow (do you have to set it for every single intent?), but I don't see any extra setting for speech.
I disabled the second language, first I had also intents in German
I also turned off the Fullfillment Webhook (implemented in API v1 and then also v2) with no change
I only found this user with the same problem https://productforums.google.com/forum/#!topic/dialogflow/xYjKlz31yW0;context-place=topicsearchin/dialogflow/Empty$20speech$20response but no resolution.
the fulfillment checkbox is checked at the intents
The bot works fine when I use it through "Try it now" on the very right in Dialog Flow or in the Web Demo https://bot.dialogflow.com/994dda8b-4849-4a8a-ab24-c0cd03b5f420
Unfortunately the docs don't say anything about this error. Any ideas?
Here a screenshot of the error on the Actions integration:
This is the full debug output:
{
"agentToAssistantDebug": {
"agentToAssistantJson": {
"message": "Failed to parse Dialogflow response into AppResponse, exception thrown with message: Empty speech response",
"apiResponse": {
"id": "c12e1389-e887-49d4-b399-a332188ca946",
"timestamp": "2018-01-27T03:55:30.931Z",
"lang": "en-us",
"result": {},
"status": {
"code": 200,
"errorType": "success"
},
"sessionId": "1517025330705"
}
}
},
"assistantToAgentDebug": {
"assistantToAgentJson": {
"user": {
"userId": "USER_ID",
"locale": "en-US",
"lastSeen": "2018-01-27T03:55:03Z"
},
"conversation": {
"conversationId": "1517025330705",
"type": "NEW"
},
"inputs": [
{
"intent": "actions.intent.MAIN",
"rawInputs": [
{
"inputType": "KEYBOARD",
"query": "Talk to Mica, the Hipster Cat Bot"
}
]
}
],
"surface": {
"capabilities": [
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
},
"isInSandbox": true,
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.AUDIO_OUTPUT"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
}
]
}
]
},
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=TOKEN' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: AUTH_TOKEN' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{\"user\":{\"userId\":\"USER_ID\",\"locale\":\"en-US\",\"lastSeen\":\"2018-01-27T03:55:03Z\"},\"conversation\":{\"conversationId\":\"1517025330705\",\"type\":\"NEW\"},\"inputs\":[{\"intent\":\"actions.intent.MAIN\",\"rawInputs\":[{\"inputType\":\"KEYBOARD\",\"query\":\"Talk to Mica, the Hipster Cat Bot\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.MEDIA_RESPONSE_AUDIO\"},{\"name\":\"actions.capability.WEB_BROWSER\"},{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"isInSandbox\":true,\"availableSurfaces\":[{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]}]}'"
},
"sharedDebugInfo": [
{
"name": "ResponseValidation",
"subDebugEntry": [
{
"debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\".",
"name": "UnparseableJsonResponse"
}
]
}
]
}
Also "debugInfo" sounds like an internal problem:
"API Version 2: Failed to parse JSON response string with
'INVALID_ARGUMENT' error: \": Cannot find field.\"."
Here a screenshot of the welcome intent:
ps.
It took me AGES to figure out, what
"Query pattern is missing for custom intent"
means - so I just document it here: In Dialog Flow - Intent - "User says" you have to DOUBLE CLICK on a word in the text input field when you want to set it as query parameter - which seems to be required for Actions on Google.
This happened to me. If this happens for an Intent you just added in the Dialogflow console and you are using Webhook fulfillment for the action, check the intent's fulfillment settings and ensure that the Webhook fulfillment slider is on. Evidently new intents don't automatically get webhook fulfillment: you have to opt each one in piecemeal (or at least, that was my experience).
I experienced this situation too.
My problem was that I used a SimpleResponse in my fulfillment index.js without referencing to it. So the solution for me was to add SimpleResponse like this in index.js:
const {dialogflow, SimpleResponse} = require('actions-on-google');
So, always check if you aren't using any dependencies without including it in your js-file.
Probably not the most common cause of the problem, but it can be.
I got this when running through the codelabs tutorial (https://codelabs.developers.google.com/codelabs/actions-1/index.html#4) and didn't name my intent the same name as it is referenced in the webhook script:
I came across this error when trying to develop my own WebHook. I first verified that my code was called by looking into the Nginx log, after which I knew there was a problem in my JSON output because I based my output on outdated examples.
The (up-to-date) documentation for both V1 and V2 of the API can be found here:
https://dialogflow.com/docs/fulfillment/how-it-works
This example response for v2 of the dialogflow webhook API helped me to resolve this error:
{
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "this is a simple response"
}
}
]
}
}
}
}
Source: https://github.com/dialogflow/fulfillment-webhook-json/blob/master/responses/v2/ActionsOnGoogle/RichResponses/SimpleResponse.json
You can find more examples in the official github repository linked above.
Another possibility is if you have a text response (even an empty one) like so:
Then you need to click the trash can next to the response to clear it out to use the webhook.
The Actions on Google support helped me fix this problem:
I needed to add a text as Default Response to the intent used for Explicit Invocation.

Using facebook API breakdowns insights

Trying to get the impressions per notification of specific group(by using ref).
By the api you can set a group for notifications by adding ref param to the notification request
That worked fine.
Now i am trying to use the API for getting insights as explained here:
insights
I still dont understand how to pass the ref param.
this is my execution:
../app_insights/app_notification_impressions?breakdowns[0]=ref&access_token={acce‌​ss-token}
And in return I get this:
{
"data": [
{
"time": "2014-12-09T08:00:00+0000",
"value": "44",
"breakdowns": {
"ref": "no_ref_specified"
}
}
]
}
How I am passing the request the ref value?
I tried all kind of combinations and I get errors.
I posted notification with diff ref. ref=test0099 and Now I see this:
{
"data": [
{
"time": "2014-12-09T08:00:00+0000",
"value": "3",
"breakdowns": {
"ref": "no_ref_specified"
}
},
{
"time": "2014-12-10T08:00:00+0000",
"value": "1",
"breakdowns": {
"ref": "test0099"
Maybe there is some bug over there?
thanks,
ray.
Edit:
Stating your findings
for some reason you cant notify with ref which is only numeric or start with numeric
Again, it still comes to down to file a bug.
From IRC, just stating that you should file a bug.
As long as the app is a canvas app and a game you should be able to see the desired response
HTTP POST /13608786/notifications with App Token and
template=Yo this is a test
ref=test0099
You should receive the notification
And be redirected to the canvas page
https://apps.facebook.com/philippeharewood/?fb_source=notification&fb_ref=test0099&ref=notif&notif_t=app_notification
The insights will reflect the same
HTTP GET /app/app_insights/app_notification_impressions?breakdowns[0]=ref
{
"data": [
{
"time": "2014-12-10T08:00:00+0000",
"value": "1",
"breakdowns": {
"ref": "test0099"
}
}
]
}
This issue apparently to be a bug.
I have assigned this into facebook developers and now they taking care of it.
tracking at: https://developers.facebook.com/bugs/1512426199028095