Problem with Post action on Strapi via Postman - postman

The problem is I can't perform PUT or POST with Postman app. But DELETE is possible. And yes I enabled all actions for public users.
Here is GET request result:
{
"data": [
{
"id": 2,
"attributes": {
"title": "23123",
"game": "1231",
"players": "2312313",
"createdAt": "2022-02-19T16:36:34.221Z",
"updatedAt": "2022-02-19T16:36:34.971Z"
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}
And here is my entries for POST request:
finally after requesting POST here is result:
{
"data": null,
"error": {
"status": 400,
"name": "ValidationError",
"message": "Missing \"data\" payload in the request body",
"details": {}
}
}
What is the problem?

I finally found the solution. u need to put Body in raw and set it as Json! default is Text.
and POST example is :
{
"data": {
"title": "Hello",
"relation": 2,
"relations": [2, 4]
}
}

Related

google-cloud-recommendation How to get next page for Prediction?

I want to use predict method in order to get recommendation devided by page.
This method has pageToken parameter used for paging. The parameter should be received in the previous prediction response.
But this method in v2 API doesn't return pageToken or nextPageToken that is in v1beta1 API.
Why it disappeared? How can I get next page for prediction?
Request url is
https://retail.googleapis.com/v2/projects/{PROJECT_NUMBER}/locations/global/catalogs/default_catalog/placements/recently_viewed_default:predict
Request body is
{
"filter": "tag=(\"成人作品\") filterOutOfStockItems",
"userEvent": {
"eventType": "home-page-view",
"visitorId": "1254704470.1607003607",
"productDetails": [
{
"product": {
"id": "220604"
},
"quantity": 1
}
]
}
}
The response is here. There is no nextPageToken
{
"results": [
{
"id": "170706"
},
{
"id": "64081"
},
:
(snip)
:
{
"id": "132940"
},
{
"id": "17557"
}
],
"attributionToken": "ChQxNzkzOTg1NDI3MTk1OTMyNzU0MhACGiNvZnRlbl9wdXJjX2ZyZXF1ZW50bHlfMTYxNDMwNjk3OTQyNSIYb2Z0ZW5fcHVyY2hhc2VkX3RvZ2V0aGVyKAA"
}

Is there any way to sort the result of Lambda function of DynamoDB?

I am using AWS Lambda to get result from Dynamo DB. The returned result from Lambda is this:
Response:
{
"Items": [
{
"name": "unknown",
"rid": "1589816220971",
"rtime": "2020-05-18 23:37:12",
"status": "unsuccessful"
},
{
"name": "acap",
"rid": "1589816876343",
"rtime": "2020-05-18 23:48:10",
"status": "successful"
},
],
"Count": 2,
"ScannedCount": 2
}
But i wanted the returned result inverted as this because i want the recent result first.
Response:
{
"Items": [
{
"name": "acap",
"rid": "1589816876343",
"rtime": "2020-05-18 23:48:10",
"status": "successful"
},
{
"name": "unknown",
"rid": "1589816220971",
"rtime": "2020-05-18 23:37:12",
"status": "unsuccessful"
},
],
"Count": 2,
"ScannedCount": 2
}
Is there any way of doing that or more better way to return the latest item first from DynamoDB using Lambda?

Graph API Batch Request. Error (#803)

I need to get friends' albums with photos. Do that with batch query (coz https://developers.facebook.com/docs/reference/fql/).
[
{ "method":"GET",
"name":"get-friends",
"relative_url":"me/friends?fields=id,name",
"omit_response_on_success": false
},
{
"method":"GET",
"name":"get-albums",
"relative_url":"{result=get-friends:$.data.*.id}/albums",
"omit_response_on_success": false
},
{
"method":"GET",
"name":"get-photos",
"relative_url":"{result=get-albums:$.data.*.id}/photos"
}
]
But in response i got error.This is response:
[
{
"code": 200,
"body": "{
"data": [
{
"id": "xxxx",
"name": "Name Lastname"
},{
"id": "xxxx",
"name": "Name2 Lastname"
}
],
"paging": {
"next": "https://graph.facebook.com/v2.4/xxx/friends?fields=id,name&format=json&access_token=xxx&limit=25&offset=25&__after_id=enc_xxx"
},
"summary": {
"total_count": 4
}
}"
},
{
"code": 200,
"body": "{
"data": [
{
"name": "1 Photos",
"created_time": "2012-11-22T04:22:46+0000",
"id": "xxx"
},
{
"name": "2 Pictures",
"created_time": "2010-09-12T02:48:42+0000",
"id": "xxx"
},
{
"name": "3 Personal",
"created_time": "2007-10-25T15:59:06+0000",
"id": "xxx"
}
],
"paging": {
"cursors": {
"after": "NTc0NyQxMzkwOQ==",
"before": "MTAxNTuyNjIzMzQwMDg5MTA="
}
}
}"
},
{
"code": 404,
"body": "{
"error": {
"message": "(#803) Some of the aliases you requested do not exist: xxx,xxx,xxx",
"type": "OAuthException",
"code": 803
}
}"
}
]
Please tell me where is my mistake or tell me another way.
You can´t get access to albums of friends, all friend permissions have been removed with v2.0 of the Graph API: https://developers.facebook.com/docs/apps/changelog#v2_0
You can only get access to albums of users who authorized your App (with user_photos, of course).

What is the "likes" field from an FB Open Graph GET og.likes request?

I've implemented functionality to Like a non-FB URL in a cross-platform mobile app (Phonegap) I'm developing, and part of functionality is that I need to find out if a user has liked a URL before, hence a GET on the og.likes object. In the result of this request there's a field in the og.likes data that I'm unsure about.
My request:
GET me/og.likes?access_token={AccessToken}&object={EncodedExternalURL}
The response:
{
"data": [
{
"id": "_____",
"from": {
"id": "______",
"name": "______"
},
"start_time": "2015-01-12T06:17:24+0000",
"end_time": "2015-01-12T06:17:24+0000",
"publish_time": "2015-01-12T06:17:24+0000",
"application": {
"name": "______",
"namespace": "______",
"id": "______"
},
"data": {
"object": {
"id": "____",
"url": "____",
"type": "website",
"title": "____"
}
},
"type": "og.likes",
"no_feed_story": false,
"likes": { // <-- this guy here and its properties
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
}
],
"paging": {
"next": "____"
}
}
What is the likes field? And the sub properties of count, can_like, user_likes? Is it that other users can like this Like?
likes field is for manage the likes that this like has. Users can like or comment a like.

Is the referral (fb_action_ids) value, stored within the activity made by a user on a timeline app?

I'm testing a timeline app I just made.
I'm using Graph API Explorer for testing.
I tested the next URL:
https://graph.facebook.com/10150691128476714
where 10150691128476714 is the id of the activity I made through my app.
It returns the next values:
{
"id": "10150691128476714",
"from": {
"name": "Moisés Briseño Estrello",
"id": "719621713"
},
"start_time": "2012-04-26T07:22:00+0000",
"end_time": "2012-04-26T07:22:00+0000",
"publish_time": "2012-04-26T07:22:00+0000",
"application": {
"name": "appname",
"namespace": "appname",
"id": "367747679937600"
},
"data": {
"objectname": {
"id": "10150825002710211",
"url": "https://young-planet-1642.herokuapp.com/AMLO.html",
"type": "appname:objectname",
"title": "TItle"
}
},
"type": "appname:actionname",
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true
}
}
I wonder if the referral (fb_action_ids) value is also stored in here or where I can find it?
Thanks in advance :)
ID of the action is the fb_action_ids value, i.e. fb_action_ids = 10150691128476714.