I have question maybe someone could help me with. I tried to find answer, but no results.
Problem:
I have 2 entities Comment and Video, comment belong to video (many to one). When send creation request to /comments with video that no exists, I'm getting next error:
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "An error occurred",
"detail": "Item not found for resource \"App\\Entity\\Video\" with id \"2\".",
and status code 400.
I want change this behavior and receive next response:
{
"type": "https://tools.ietf.org/html/rfc2616#section-10",
"title": "An error occurred",
"detail": "Item not found for resource \"App\\Entity\\Video\" with id \"2\".",
"violations": [
{
"propertyPath": "video",
"message": "Item not found for resource \"App\\Entity\\Video\" with id \"2\".",
"code": "c1051bb4-d103-4f74-8988-acbcafc7fdc3"
}
]
}
and status 422.
Question:
How can I validate related fields?
I already tried create custom validator, but /vendor/api-platform/core/src/Serializer/AbstractItemNormalizer.php return error before my validation.
If you have any solutions for this, I'll really happy. Anyways thank you!
https://symfony.com/doc/current/reference/constraints/Valid.html may help : you just add the validator #Assert\Valid to check if the child exists
Related
I am trying to make a function that can search for a file/folder. If the file/folder exists then it will return the id else will return null from the drive in PHP, but every time I do this it shows that there is some error in q.
An error occurred: {
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Invalid Value"
}
}
The query is:-
//testing-folder-of-api is the name of the folder
mimeType=application/vnd.google-apps.folder and name='testing-folder-of-api'
I also tried with changing it like:
mimeType!=application/vnd.google-apps.folder if not a file
name contains 'test.txt' and title='test.txt' for searching it by name.
The solution that I found was that to loop through all the files and check the name individually using a loop which took to much time.
Can someone plz show me how to do it. Please!!
Issue:
You should add single quotes around 'application/vnd.google-apps.folder', as mentioned at File-specific query terms:
mimeType: MIME type of the file. Surround with single quotes '.
Solution:
mimeType='application/vnd.google-apps.folder' and name='testing-folder-of-api'
I'm trying to create some slides with the Slides API but I started getting this error Invalid presentation.presentationId: The id is invalid.
I tried to create it through the API reference without success as shown in the image:
Reference request and error image
Is there any limitation on the presentationId or some other required fields I should pass?
This is the exception I get:
{
"error": {
"code": 400,
"message": "Invalid presentation.presentationId: The id is
invalid.",
"errors": [
{
"message": "Invalid presentation.presentationId: The id is invalid.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
You want to create new Slide using Method: presentations.create. If my understanding is correct, how about this?
In your case, please try it using the request body with title and without presentationId as follows.
Note :
At this request body, a new Slide with the filename of "Teste123" is created to the root.
Reference :
Method: presentations.create
If I misunderstand your question, I'm sorry.
Dont specify a presentation ID -- just a title and the API call should work as you expect. The presentation ID will be generated by Slides for you.
Previously, Slides would ignore all presentation IDs passed in on create, but this behavior changed recently. See documentation for presentations.create
I'm using Google Natural API to analyze entities in text which I pull from DB. Everything was working fine, but suddenly it is showing me this error.
{ "error": { "code": 400, "message": "The language ur is not supported for entity analysis.", "status": "INVALID_ARGUMENT" } }
The text is simple English. May contains some links in it but nothing special. Please help me how to fix this issue.
Thanks.
So i have run through the guide of how to read data from a google sheet using their API. All works fine until i want to read from any sheet other than the one given in the example.
https://developers.google.com/sheets/api/quickstart/php
is there something else that i need to change as when I update the spreadsheet id to one of mine i just get the following
Fatal error: Uncaught exception 'Google_Service_Exception' with message '{
"error": {
"code": 400,
"message": "Unable to parse range: Class Data!A2",
"errors": [
{
"message": "Unable to parse range: Class Data!A2",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Any help would be greatly appreciated.
sorry guys the issue was that i was declaring the range wrong problem now sorted.
I am trying to get Google Play API subscription details using PHP and using following url to get purchase data :
https://www.googleapis.com/androidpublisher/v1/applications/[PACKAGE]/subscriptions/[SKU]/purchases/[PURCHASE_TOKEN]?access_token=[ACCESS_TOKEN]
I am getting the following error:
{
"error": {
"errors": [
{
"domain": "androidpublisher",
"reason": "developerDoesNotOwnApplication",
"message": "This developer account does not own the application."
}
],
"code": 401,
"message": "This developer account does not own the application."
}
}
Please help me sort out.
Just providing the URL does not help you get data of any application. How can you think so.? Isnt it insecure.? You have to get proper data by which you can at least prove ownership for the app..