So I'm trying to implement the google appstate cloud save feature to save a string (https://developers.google.com/games/services/web/api/states) but I am getting a 409 conflict error. I must be using it incorrectly. Does anyone have any examples of a JavaScript implementation?
This is how I am going about it:
GET https://www.googleapis.com/appstate/v1/states
returns:
{
"kind": "appstate#listResponse",
"maximumKeyCount": 4,
"items": [
{
"kind": "appstate#getResponse",
"stateKey": 0,
"currentStateVersion": "CNDVopDDwLgC"
}
]
}
then I
PUT https://www.googleapis.com/appstate/v1/states/0
with body:
{
currentVersion: "CNDVopDDwLgC"
data: "some data"
kind: "appstate#updateRequest"
}
which gives the error: 409 Conflict
{
"error": {
"errors": [
{
"domain": "global",
"reason": "OutOfDateVersion",
"message": "The resource version you are attempting to modify does not match the current version on the server."
}
],
"code": 409,
"message": "The resource version you are attempting to modify does not match the current version on the server."
}
}
Does anyone know what I am doing wrong?
Related
I have a collection named templates. It has a field 'sec_1' which is an array of objects with properties 'name' and 'des' both of type string. Now I'm using elastic search and when I try to execute a query that matches only title fields I get an error saying the sec_1 field is not nested. Upon checking the mappings here is what I get mapping type of sec_1 is text.
I checked online and saw the fix was to modify the mapping. I created a new index like:
`curl base_url/new_index_name
{
"mappings":
{"properties": {
"sec_1": {
"type":
"nested","properties": {
"name": { "type": "text" },
"des": { "type": "text" }
}
}
}
}
}
and then reindexed like this:
curl base_url/_reindex
{
"source": {
"index": "old_index"
},
"dest": {
"index": "new_index"
}
}`
First request is successful, the second one fails with this error:
{
"index": "new_index",
"type": "_doc",
"id": "be5123a4-d0e8-4d7b-a8f1-42f31d37fe55",
"cause": {
"type": "mapper_parsing_exception",
"reason": "object mapping for [sec_1] tried to parse field [null] as object, but found a concrete value"
},
"status": 400
},
I don't understand why this is happening and what I'm doing wrong. Please help. I do not know much about elastic search, I've looked for solutions online, tried chatgpt too but the same steps appear. I'm finding the reason for this error is that sec_1 is not nested type but I've checked in database it is an array of objects. What else could be wrong?
I tried creaing new index but cannot do that and without new index my search query cant function properly
I am building a dashboard so I can easily view how many people currently have a specific label in my facebook messenger. I'm just developing this for my page that I'm admin at, so it's only for this one page.
The final result is this:
Label 1 - 38 People
Label 2 - 82 People
Label 3 - 47 People
First I get the participants using this endpoints: {page-id}/conversations?fields=participants
I get this sample:
{
"data": [
{
"participants": {
"data": [
{
"name": "Particiapnt's name",
"id": "<psid>"
},
{
"name": "My Page Name",
"id": "<my-pageid>"
}
]
},
"id": "<thread-id>"
}
]
}
Now when I use participants id (psid) to get custom labels using this endpint: /custom_labels
I get this error:
{
"error": {
"message": "Unsupported get request. Object with ID 'xxxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "A5kFh5U-xSMB83ZnQrbzEfy"
}
}
Please help.
That's the error data returned from App Sync AWS:
{
"data": {
"getContentById": null
},
"errors": [
{
"path": [
"getContentById"
],
"data": null,
"errorType": "Lambda:Handled",
"errorInfo": null,
"locations": [
{
"line": 1,
"column": 2,
"sourceName": null
}
],
"message": "ID is not found"
}
]
}
How can I change the 200 Status code from my lambda function?
Screen shot from PostMan
Currently you cannot customize the error status code in AWS AppSync. The suggested approach is to use errorType in the error response. You can use $util.appendError or $util.error methods in your velocity mapping template to define the error type.
I ve been using this end point :
{page-id}/threads
and it returns the following:
{
"error": {
"message": "(#100) Tried accessing nonexisting field (threads) on node type (Business)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "EdclPzbf+Aw"
}
}
Want to set up the webhook on my pc and not on google cloud project like the guide is sugesting, and I'm not quite sure how to.
This is the guide: https://dialogflow.com/docs/getting-started/basic-fulfillment-conversation
It says to create a index.js with the following code in it
/*
* HTTP Cloud Function.
*
* #param {Object} req Cloud Function request context.
* #param {Object} res Cloud Function response context.
*/
exports.helloHttp = function helloHttp (req, res) {
response = "This is a sample response from your webhook!"
//Default response from the webhook to show it's working
res.setHeader('Content-Type', 'application/json');
//Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};
Never seen exports. before. The guide wants me to do something with 'google functions' and make one called hellohttp or something. Trying to figure out how to do it without google cloud projects.
I installed Node.js and created that file. I set the webhook url to https://my_ip/index.js but doesn't work. Not really sure what to do
this is the JSON I get
{
"id": "9c244834-3ee9-4291-98fd-aab8e975fb1f",
"timestamp": "2018-02-22T23:11:34.067Z",
"lang": "en",
"result": {
"source": "agent",
"resolvedQuery": "weather TOMORROW in VIRGINIA",
"action": "",
"actionIncomplete": false,
"parameters": {
"date": "2018-02-24",
"geo-city": "Virginia"
},
"contexts": [],
"metadata": {
"intentId": "44486050-dfd5-4c35-bcbf-4e168379df28",
"webhookUsed": "true",
"webhookForSlotFillingUsed": "false",
"webhookResponseTime": 5006,
"intentName": "Weather"
},
"fulfillment": {
"speech": "I don't know about the weather for 2018-02-24 in Virginia. Sorry!",
"messages": [
{
"type": 0,
"speech": "I don't know about the weather for 2018-02-24 in Virginia. Sorry!"
}
]
},
"score": 1
},
"status": {
"code": 206,
"errorType": "partial_content",
"errorDetails": "Webhook call failed. Error: Webhook response was empty.",
"webhookTimedOut": false
},
"sessionId": "9cdbd5bc-403e-4840-8970-e420f27d23e2"
}