Google YouTube Data API version 3, videoEmbeddable error - search

I am trying out the youTube Data API v3, on this page: https://developers.google.com/youtube/v3/docs/search/list
Every requests works fine, as long as the videoEmbeddable parameter is left blank. As soon as I set it to true or any, I get a bad request response.
{
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "Invalid combination of search filters and/or restrictions.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Invalid combination of search filters and/or restrictions."
}
}
Am I missing something?

If you set videoEmbeddable=true, you MUST also set type=video, otherwise you'll get the "Invalid combination of search filters and/or restrictions" error.

I think this is a case where you're dealing with the experimental nature of the v3 API (still in beta, technically). If you look earlier on the page, the videoEmbeddable parameter is no longer listed (nor are parameters such as videoSyndicated, publishedBefore/publishedAfter, etc), and so aren't supported in the actual API, even though the API explorer hasn't been updated to match. Hopefully the API explorer will be brought back into sync soon; until then, you could run your own tests following the API reference.

Related

How can I include the "source" field from the Microsoft Azure Custom Question Answer API?

I am leveraging the latest iteration of Azure's Custom question answering module in language studio in an external app that I've created, and I cannot figure out how to receive the actual source when the question is answered. I don't know if that's because you just can't right now or what, but in the actual API docs for the request/answer sample, the answer sample includes the source field - no matter what I've tried, I can't get it to show up.
Page where API doc is found - https://learn.microsoft.com/en-us/rest/api/cognitiveservices/questionanswering/question-answering/get-answers#knowledgebaseanswer
Quick example snippet of how I've adapted the API:
{
"question": "<question>",
"top": 3,
"userId": "<user>",
"confidenceScoreThreshold": 0.2,
"rankerType": "Default",
"filters": {
"metadataFilter": {
"metadata": [
],
},
},
"answerSpanRequest": {
"enable": true,
"confidenceScoreThreshold": 0.2,
"topAnswersWithSpan": 1
},
},
"includeUnstructuredSources": true
}
I understand the metadata bit has nothing there, I may add something later but as of now I'm not messing with the metadata aspect in language studio sources themselves.
At any rate, the bottom line is I don't see an option to display a source, and I don't get it back in the body of the request - yet I see it in the sample response in the API doc, so what gives, am I missing something?

Azure Face Recognition gives "Attribute 'qualityForRecognition' is only supported for recognition_03 and recognition_04." error

I'm following the official MS Azure quickstart guide (https://learn.microsoft.com/en-gb/azure/cognitive-services/face/quickstarts/client-libraries?tabs=visual-studio&pivots=programming-language-rest-api), specifically the "Get face attributes" part and when replicating provided cURL examples in Postman, I'm getting the following error:
{
"error": {
"code": "BadArgument",
"message": "Attribute 'qualityForRecognition' is only supported for recognition_03 and recognition_04."
}
}
Any ideas? It seems like they've updated their API without updating documentation, which is something I wouldn've expected from a corp like Microsoft, but it's the only thing I can think of why it wouldn't be working. For reference, here's a screenshot of my Postman request.
As per documentation:
To extract face attributes, call the Detect API again, but set detectionModel to detection_01. Add the returnFaceAttributes query parameter as well.
Detect with stream example:
POST {Endpoint}/face/v1.0/detect?overload=stream&returnFaceAttributes=age,gender,headPose,smile,facialHair,glasses,emotion,hair,makeup,occlusion,accessories,blur,exposure,noise&recognitionModel=recognition_01&returnRecognitionModel=True&detectionModel=detection_01
Ocp-Apim-Subscription-Key: {API key}
returnFaceAttributes: Analyze and return the one or more specified face attributes in the comma-separated string like "returnFaceAttributes=age,gender".
Note: detection_01 supports age, gender, headPose, smile, facialHair, glasses, emotion, hair, makeup, occlusion, accessories, blur, exposure, noise, and qualityForRecognition While detection_02 does not support any attributes and detection_03 only supports mask and qualityForRecognition. qualityForRecognition is only supported when the 'recognitionModel' is specified as 'recognition_03' or 'recognition_04'.
As per Add QualityForRecognition in Face how-to samples, detection_01 is used with recognition_04
var faces3 = await faceClient.Face.DetectWithUrlAsync(url: imageUrl, returnFaceId: true, returnFaceAttributes: requiredFaceAttributes, detectionModel: DetectionModel.Detection01, recognitionModel: RecognitionModel.Recognition04);
You can also refer to Add qualityForRecognition attribute to Face Detection

Google Places API returns 0 results after deploying on Google Cloud

I have developed an application that is powered by Google Places API. The problem is the places are loading when running locally but not after deploying it on google cloud. I am using a default keyword to fetch the desired results but surprisingly it is not working after its deployed. I tried changing the keyword but still, it returns 0 results. Please have a look at my code below
await axios
.get("https://maps.googleapis.com/maps/api/place/nearbysearch/json", {
params: {
key: process.env.GOOGLE_PLACE_API_KEY,
location: req.body.ll,
radius: 20000,
keyword: "popular destinations near me",
},
})
and the response I get
{ html_attributions: [], results: [], status: 'ZERO_RESULTS' }
Postman request of the same works without any issue
and the same request sent with a raw JSON data, I am getting an error
{
"key": "my key",
"location": "my location",
"radius": "20000",
"keyword": "popular destinations near me"
}
{
"error_message": "You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account",
"html_attributions": [],
"results": [],
"status": "REQUEST_DENIED"
}
The same request sent using postman returns 20+ results. I have no clue what could possibly be wrong with the above request. Any help is appreciated, thanks.
The Place API Place Search Nearby Search requests required parameters which are key, location, and radius. There are optional parameters you can input too, they are
keyword(not keywords),
language,
minprice&maxprice,
name,
The name field is no longer restricted to place names. Values in this field are combined with values in the keyword field and passed as part of the same search string. We recommend using only the keyword parameter for all search terms.
opennow,rankby,type,pagetoken.
So you cannot assign more than one keyword to your request.

Getting image link to Sharepoint list picture using Microsoft Graph

Im trying to retrieve some information from a Sharepoint list that contains our Company news. I have looked through our columns that exists and realized that the image is located at a column named PublishingRollupImage.
My call to microsoft looks like this:
https://graph.microsoft.com/v1.0/sites/{tenant id}/lists/posts/items?$expand=fields($select=Title,body,DepartmentCompany,PublishingRollupImage)
BUT - if i make this call, the response will be:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.ClientServiceException",
"message": "Cannot serialize data for type Microsoft.SharePoint.Publishing.Fields.ImageFieldValue.",
"innerError": {
"request-id": "f885269e-da21-45a0-b3e4-e304f4e01edb",
"date": "2018-12-10T12:12:25"
}
}
}
This is of corse due to that i'm getting the whole image sent by adding this. But i read that i could use .ImageUrl to cast it to a link instead, but i'm not sure if this could be done in a call like this.
Has anyone any pointers to give?
The Object Model(CSOM/JSOM) way return object list but not JSON, so it does not need to serialize. Graph way return JSON, it need serialize operation.
No available workaround for this now, so you may not use the field by Graph now. You could submit one feature request on the UserVoice.

XPages Extlib REST update (HTTP PUT) on calendar event is returning error code (cserror : 1028)

I am trying to update a calendar event in Domino Mail Calendar by using the REST data service "calendar" from the latest xpages extlib release "ExtensionLibraryOpenNTF-901v00_13.20150611-0803".
Has anybody done this with a successful return?
Unfortunately I haven't had any success trying to update a calendar event. I was successful getting the list of events, creating events, deleting an event, but to update an event seems to be somehow special. The PDF documentation for the calendar service is quite short on this point. My domino server is accepting all protocols including PUT. I am using the JSON format for my REST calls. The UPDATE I tried as described in the documentation with iCAL as well, but getting the same error.
I am using the Firefox REST Plugin for checking out the service, before I am implementing it.
Im using PUT, with content-type "text/calendar" as well "application/json".
My URL:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D
My Body looks like this, which is the easiest event type, a reminder (but I tried it with meeting and appointment as well):
{"events":[{"UID:"4D750E2B8159D254C1257E9C0066D48D","summary":"Ein Reminder update","start":{"date":"2015-08-13","time":"13:00:00","utc":true}}]}
This is how I return the event by a GET:
{
"href": "/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"id": "4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated",
"summary": "Ein Reminder",
"start": {
"date": "2015-08-12",
"time": "07:00:00",
"utc": true
},
"class": "public",
"transparency": "transparent",
"sequence": 0,
"x-lotus-summarydataonly": {
"data": "TRUE"
},
"x-lotus-appttype": {
"data": "4"
}
}
This is the error I get:
{
"code": 400,
"text": "Bad Request",
"cserror": 1028,
"message": "Error updating event",
"type": "text",
"data": "com.ibm.domino.calendar.store.StoreException: Error updating event\r\n\tat com.ibm.domino.calendar.dbstore.NotesCalendarStore.updateEvent(NotesCalendarStore.java:229)\r\n\tat ... 65 more\r\n"
}
The attributes in the body I tried a lot of different things, using the id, no id, an UID like in the calendar service doumentation, ...
What am I doing wrong here?
The solution:
Using the PUT method, the URL which worked looks like this:
http://sitlap55.xyzgmbh.de:8080/mail/padmin.nsf/api/calendar/events/4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated
the BODY looks like this:
{"events":[{"id":"4D750E2B8159D254C1257E9C0066D48D-Lotus_Notes_Generated","summary":"Some Reminder update #6","start":{"date":"2015-08-13","time":"10:00:00","utc":true}}]}
What I figured out was, that the "id" attribute is required ! a bit strange, because it is already in the URL.
I just checked against the documentation for Domino Access Services (DAS) 9.0.1 - and the example they have there actually works.
I tried a few things before that, e.g. if I could PATCH (change individual fields) or PUT (change ALL fields) just specifying the non-system fields. None of these worked. But taking the response from creating (or getting) the event and put it into a PUT request and adjust e.g. start time works fine.
Looking at your example I think the issue is similar as you do not include the end time in the request. But even so you seem to have to include the entire record as it is returned from the service - and please note that the url must end on the ENTIRE id (i.e. including "...-Lotus_Auto_Generated") :-)
/John
Edit:
It seems you don't need to add all fields... But be aware of the side effects of not specifying fields... You need to test it for yourself!

Resources