I have been facing this weird issue lately that on a given model when I try to fetch an item by Id it throws an error even though this item exists in the db.
{ "error": {
"statusCode": 404,
"name": "Error",
"message": "Unknown \"BidSample\" id \"5afc396af6584c07cf1b729c\".",
"code": "MODEL_NOT_FOUND" } }
I am using mongo database and loopback 3.
It might be that in the database it has been soft deleted.
Related
My firestore DB structure: 2020/abhishek/friend-requests/ where 2020 is a collection, abhishek is a document and friend-requests is a collection inside the document.
What am I trying to do?
I'm trying to create a new document inside friend-requests using REST API.
What I did so far?
I made a POST request to this endpoint:
https://firestore.googleapis.com/v1/projects/fuze-eee88/databases/(default)/documents/2020/abhishek/friend-requests/?documentId=newdocument
Request body:
{
"fields": {
"status": {
"booleanValue":"true"
}
}
}
The error I get:
{
"error": {
"code": 400,
"message": "Document parent name \"projects/fuze-eee88/databases/(default)/documents/2020//abhishek\" lacks a resource id at index 55.",
"status": "INVALID_ARGUMENT"
}
}
Seems you are getting that error because the document with the ID newdocument already exists in your Firestore database.You have to choose a unique ID for every new document that you add to Firestore database. You may try using a different ID, such as newdocument1 instead of new document.
You can have a look at below sample url
https://firestore.googleapis.com/v1/projects/<YOUR_PROJECT_ID>/databases/(default)/documents/<YOUR_COLLECTION_NAME>/<YOUR_DOCUMENT_ID>/<YOUR_SUBCOLLECTION_NAME>/?documentId=<YOUR_UNIQUE_ID>
After editing the above url as per your configuration will become:
https://firestore.googleapis.com/v1/projects/fuze-eee88/databases/(default)/documents/2020/abhishek/friend-requests/?documentId=newdocument1
I'm using postman in order to call SuiteCRM REST API.
I tried to call this endpoint
PATCH http://{{suitecrm-url}}/Api/V8/module
and i've added this payload to the body (Content-Type: Application/Json):
{
"data": {
"type": "Accounts",
"id": "3a3ae651-d509-2508-7dc4-5be2e51cc96b",
"attributes": {
"name": "name with space"
}
}
}
When the request is executed SuiteCRM gives this response:
{
"errors": {
"status": 400,
"title": null,
"detail": "The option \"attributes\" with value array is invalid."
}
}
I found out that the problem was the whitespace in the value: when i tried to use the value "namewithspace", it worked.
Anyone has any idea how to solve this problem ?
Thanks in advance
I found out this issue on github that resolved my problem:
https://github.com/salesagility/SuiteCRM/issues/6452
In short to make it work i had to modify the file in
/Api/V8/Params/Options/Fields.php
and replace this line
const REGEX_FIELD_PATTERN = '/[^\w-,]/';
with
const REGEX_FIELD_PATTERN = '/[^\w-,\s\]/';
The person mentioned in github:
this is just for temporary fix and not upgrade safe
I have passed a conversation from a primary application to a secondary application, I used the call https://graph.facebook.com/v2.6/me/pass_thread_control with the following data:
{"recipient": {"id": "xxxxxxxx"},
"target_app_id": xxxxxx,
"metadata": "test to pass to secondary receiver app",
"pass_thread_control": {
"new_owner_app_id": "xxxxx",
"metadata": "metadata to test"
}
}
it has returned true, that is, the secondary application has control.
The problem I have is to return the conversation to the primary application, I am using the call https://graph.facebook.com/v2.6/me/take_thread_control
{
"recipient": {
"id": "xxxxxxxx"
},
"metadata": "additional content that the caller wants to set"
}
and returns:
"error": {
"message": "(# 10) Only Main Receiver can call this API",
"type": "OAuthException",
"code": 10,
"error_subcode": 2018169,
"fbtrace_id": "DnBvWqt / 0bd"
}
What am I doing wrong?
What are the calls I must make consecutively?
How can I know which application has the conversation?
Another thing that I have seen is that I have tried to make this call:
https://graph.facebook.com/v2.6/me/secondary_receivers
and return this message:
"error": {
"message": "(# 10) Only Main Receiver can call this API",
"type": "OAuthException",
"code": 10,
"error_subcode": 2018169,
"fbtrace_id": "Gt1WsVx9W22"
}
Do I need some permission?
take_thread_control and secondary_receivers can only be called by the Primary Receiver app. If you want the Secondary Receiver to pass thread control back to the Primary, you need to call pass_thread_control from the Secondary.
take_thread_control is specifically reserved for the Primary, which pass_thread_control is for primary and secondary.
I'm trying to update my adset's targeting location to include 2 zip codes 85233 and 85224 but facebook keeps returning an Unknown error.
My request is
https://graph.facebook.com/v2.11/[ADSET_ID]
targeting={ "geo_locations":{"zips":[{"key":"US:85233"},{"key":"US:85224"}]}}
access_token=[ACCESS_TOKEN]
Response:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "EA9s0p59E9h"
}
}
Please let me know the correct way to do this?
UPDATE: I have tried to update adset geolocation by lat and lng but the same error happened.
{
"geo_locations":{
"custom_locations":[
{
"radius":30,
"latitude":30.1519297,
"longitude":-97.8338758
}
]
}
}
Can you try to use "/v2.4/" and check whether it returns a proper response?
Because it seems like a FB API bug. Check this: https://developers.facebook.com/bugs/486654544831076/
I'm having a bit of an issue here with grabbing a value off of my entity, I think it may be related to the reflection or hydration w/in Doctrine, but I'm not sure... All I know is if I run:
$product = $entity->getRepository('Products')->findOneBy(array('product_id' => $site->product_id));
If I return $product here, I get the collection:
{
"product_id": 1,
"title": "Product",
}
But if I try to return $product->title I get
{
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Not Found",
"status": 404,
"detail": "Entity not found."
}
Any thoughts?
A coworker helped me through this one... apparently Apigility hydrates the collection, but requires everything sent back as an array. So the object gets serialized, but the integer gets errored. So...
I changed $product->title
to [$product->title]