Troubleshooting Microsoft Cognitive Services Face API - microsoft-cognitive

Earlier today, I was able to send snapshots to the Face API and get responses including faceAttributes describing emotion.
I'm using JavaScript via XMLHttpRequest.
Now, though I've not changed the code, I get OK 200 from the API calls, but the responseText and the response properties are both, "[]".
I'd like to troubleshoot to see what I'm doing wrong, but it seems like the only information available in the cognitive services portal relates to quota.
Where should I look for further analytics?

You'll get an empty response if the API does not detect a face in the image or if the image file is too large (>4MB). You can confirm by testing with an image you know previously worked. To get the best results, make sure the face is well-lit and all features are reasonably visible.

Hello from Cognitive Services - Face API Team,
I wonder the problem belongs to one specific image or all API calls?
For a quick check, you can try the image on the online demo [1].
[1] https://azure.microsoft.com/en-us/services/cognitive-services/face/

Unfortunately doing the troubleshooting from the external perspective is quite difficult since you don't get any logs. The most common steps are to try to repro your problem using either the testing console (https://westus.dev.cognitive.microsoft.com/docs/services/563879b61984550e40cbbe8d/operations/563879b61984550f3039523b) or a tool such as curl or Fiddler so that you can see the raw REST request and response.
With one of those tools you can try to change up your request, try to call a different API, make sure there are no additional details being returned in the body or response headers, etc.
If all else fails please open a support incident from the Azure management portal and we can work with you.
We are also working to improve the logging and troubleshooting capabilities, but it may be some time to see improvements in this area.

Related

Server-side Tag Manager and Mobile Apps

I'm trying to understand the section on Mobile Apps on https://developers.google.com/tag-platform/tag-manager/server-side/send-data . I'm at a loss when it comes to following these instructions for mobile. I'm trying to capture data that I can send to my own server (potentially as well as to GA4) so in the server side container I have a client which sends to my API.
The main sentence I need help with is "Set the value of Image URL to a pixel image on the server container at the path in the Measurement Protocol client that you specified earlier".
Can anyone point me to a dummy's type guide about how to create that pixel image on the server container?
Also, "Measurement Protocol client that you specified earlier" doesn't seem to correspond to anything in the previous instructions, and the link to Measurement Protocol implies that GA4 should be used instead. How would this work with the scenario I'm setting up?
Has anyone actually got sGTM working with mobile apps?
Mobile apps are irrelevant here, really. As long as you're capable of generating a generic http request, your platform doesn't matter. You can send hits from an excel sheet via VBA.
Yes, clients in sgtm are confusingly closely tailored to GA. Well, it doesn't really matter. You will still have a custom request tag type, so just go with MP.
Now the path thing. The requests coming to the sGTM endpoint are supposed to have different paths, based of which sGTM will make a decision about which client to use. Here:
Good, now to the image url and pixel image talk. That's just sGTM making it easier to use for marketeers who have a vague idea of a network request, but they know how pixel images work. In case you don't know, by loading a pixel from a third party server on our first-party page, we force the clients to send a request to that server. In the url of the pixel, marketeers typically indicate a lot of information that they want to pass to the server via query params. Basically, it's just a somewhat user-friendly abstraction over http requests. Much easier to deploy, too.
Finally, this is how your tag should look like, approximately:
I recommend reading this article from Simo since it has the exact technical incline that would be more useful to developers.

Receiving 400 Bad Request error with Google Api Batch Request

I'm having an issue with an Analytics API batch request that I am doing, it was working and now it isn't without me changing anything. I know Google are making changes to their batch endpoints and I believe this is what is causing my errors.
https://developers.googleblog.com/2018/03/discontinuing-support-for-json-rpc-and.html
I am using the .NET client library with the AnalyticsService. Having read through the link above I'm fairly certain I've done what is needed for my batching to continue to work.
Here is a screenshot of the .NET instructions
I've upgraded all Google libraries to the latest versions, I've checked the AnalyticsService object and can confirm the BatchURI is no longer the Global HTTP Batch endpoint www.googleapis.com/batch, it is showing as https://www.googleapis.com/batch/analytics/v3, but I am still getting 400 Bad Requests. Is there something else that I am missing, or do I have to wait until the 12th of August when Google say the switch will be complete?
Thanks
Update: I created an issue on GitHub, apparently it is an internal issue, currently waiting for a fix, see here to keep updated:
GitHub Issue on .NET client library

PageSpeed Insights API: usability, security and metrics missing from json response

I am using PageSpeed Insights API to grab speed metrics of different websites and integrate the data in a tool I'm creating.
If I try a query using the API test tool (https://developers.google.com/speed/docs/insights/v4/reference/pagespeedapi/runpagespeed), then everything is fine and I get the info I need.
However, when I perform the very same query (as far as I can see) from my server, the response json does not include the same information. Some information is just missing.
Basically, other than the 'initial_url', all the metrics information that should be included in the 'loadingExperience' branch is missing. No info on 'FIRST_CONTENTFUL_PAINT_MS' or 'DOM_CONTENT_LOADED_EVENT_FIRED_MS'.
On the other hand, I can't seem to find the way to request info on USABILITY and SECURITY under the 'ruleGroups' branch. According to the API reference, this branch should feature information on these aspects too, but nothing like that is return after the query. Just the SPEED branch info is returned.
This is the URL I use to query the API:
https://www.googleapis.com/pagespeedonline/v4/runPagespeed?url=https://stackoverflow.com&strategy=mobile&screenshot=true&locale=en&key=XXXXXXXXmyAPIKeyXXXXXXXX';
Am I missing anything? I have checked the API documentation and Google'd for more info on this, but I can't seem to find any parameter to force request this information.
(By the way, this is my first question at StackOverFlow, so I hope I have shared all the necessary information. And apologies if my english is bad. I do my best.)
I'm having the same issue with some websites. The problem is related to the website. Some websites are providing the userExperience.metrics object and some are not. I have no idea what is causing this.
However you can try to use strategy=desktop parameter to get the userExperience.metrics object in version 5. This worked for me.
Working URL: https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=https://stackoverflow.com&strategy=desktop&key=[SetYourApiKeyHere]

How do I handle use 100 Continue in a REST web service?

Some background
I am planning to writing a REST service which helps facilitate collaboration between multiple client systems. Similar to how git or hg handle things I want the client to perform all merging locally and for the server to reject new changes unless they have been merged with existing changes.
How I want to handle it
I don't want clients to have to upload all of their change sets before being told they need to merge first. I would like to do this by performing a POST with the Expect 100 Continue header. The server can then verify that it can accept the change sets based on the header information (not hard for me in this case) and either reject the request or send the 100 Continue status through to the client who will then upload the changes.
My problem
As far as I have been able to figure out so far ASP.NET doesn't support this scenario, by the time you see the request in your controller actions the POST body has normally already been completely uploaded. I've had a brief look at WCF REST but I haven't been able to see a way to do it there either, their conditional PUT example has the full request body before rejecting the request.
I'm happy to use any alternative framework that runs on .net or can easily be made to run on Windows Azure.
I can't recommend WcfRestContrib enough. It's free, and it has a lot of abilities.
But I think you need to use OpenRasta instead of WCF in order to do what you're wanting. There's a lot of stuff out there on it, like wiki, blog post 1, blog post 2. It might be a lot to take in, but it's a .NET framework thats truly focused on being RESTful, and not RPC like WCF. And it has the ability work with headers, like you asked about. It even has PipelineContributors, which have access to the whole context of a call and can halt execution, handle redirections, or even render something different than what was expected.
EDIT:
As far as I can tell, this isn't possible in OpenRasta after all, because "100 continue is usually handled by the hosting environment, not by OR, so there’s no support for it as such, because we don’t get a chance to respond in the asp.net pipeline"

Alternatives to whurl for sharing api responses

I used to use whurl.heroku.com to make http web requests and share the responses with people. It's a great service for allowing people to see the results of requests themselves and test fixes.
It appears that whurl is going offline soon. Are there any good alternatives out there (besides hosting my own)?
Similar to what Mihai posted, I found Advanced Rest Client, a google chrome app. I prefer ARC a little more as it's an app so it doesn't take up space in my URL bar, and also because it's easier to use and has a richer saved history feature than XHR.
It seems someone is hosting Whurl again on heroku.com, https://gcurl.heroku.com/.
You can use XHR Poster extension for Google Chrome. Contains many of the functionalities of whurl.
It has JSON pretty print feature and handles all types of requests.

Resources