How can i exclude Domains in the Houndify API?
In the RequestInfoJSON documentation is a field called domains to "omit some domains when doing a request". However there is no format specified.
By analysing the SDK i discover the following structure:
"Domains": {
"Exclude": {
"DomainNames": ["weather"]
}
}
However, no matter which domain name i put into the array the domain will be executed. (By using the "only" functionality i got a NoResultCommand.) Disabling the domains in the dashboard is no option for me.
Here is the doc explaining "Domains" parameter.
Specifying following value to "Domains" parameter as part of request header in API tester seems to have successfully suppressed "Wikipedia" domain to be invoked:
{"Exclude": {"DomainNames": ["Wikipedia"]}}
Related
The Strapi API responds the media URLs as something like "url:'/uploads/thumbnail.png'".
I would like to get the complete URL that links to my file as value for "url". For example: "url:'https://example.org/uploads/thumbnail.png'"
The documentation also shows the full URL as response. How can I achieve this?
The full URLs come from using an upload provider such as AWS-S3 or Cloudinary. The local provider doesn't support full URLs at the moment.
There are some potentials reasons why you shouldn’t store a full URL, and respond with a full URL. I won’t dive into those reasons.
I suggest creating the entire request/response, or creating a middleware component to intercept the response.
Then you can modify the original url value with the site’s URL. Looping through the results with something like:
const serverHost = strapi.config.get('server.host', 'defaultValueIfUndefined');
url = serverHost + url;
See the following docs for more details:
https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/configurations.html
https://docs.strapi.io/developer-docs/latest/development/backend-customization/middlewares.html#implementation
We've built back in 2017 or so a scheduled script that tests bunch of URIs against Google's AMP validation API.
Haven't checked the script in ages, but recently one of our users complained that none of the URIs list AMP equivalents (the reason we used the API for, to look up AMP versions of the pages).
Now, looking at Google's documentation and testing our JSON payload with the embedded test panel there, everything works.
But when doing the same data from our servers against the API endpoint they list, we get 404 error. Actually, just copy/pasteing the API endpoint URI to a browser returns 404, too, which is kinda unexpected.
Is there something we're missing or has Google simply shut down the service, without notifying on their documentation page about it, or..?
I am simply posting basic JSON payload with URIs that I want to check if they have AMP version available, as, for example, this:
{
"urls": [
"https://www.dailymail.co.uk/sport/football/article-6729017/Is-VAR-working-change-Reporters-analyse-video-technology-football.html?ns_mchannel=rss&ns_campaign=1490&ito=1490",
"https://www.talouselama.fi/uutiset/te/2223797c-6be5-3be1-b1aa-f774ff23d63e","https://www.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line"
],
"lookupStrategy": "FETCH_LIVE_DOC"
}
to:
https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet
with POST, having service key as the query parameter (?key=xxx).
Whats we get in return, is 404. No errors, no JSON data, just plain old HTML formatted 404.
The service is fine and your query should return:
{
"ampUrls": [
{
"originalUrl": "https://www.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line",
"ampUrl": "https://amp.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line",
"cdnAmpUrl": "https://amp-theguardian-com.cdn.ampproject.org/c/s/amp.theguardian.com/uk-news/2019/feb/21/teenager-shot-in-fight-on-london-tube-barking-hammersmith-and-city-line"
},
{
"originalUrl": "https://www.dailymail.co.uk/sport/football/article-6729017/Is-VAR-working-change-Reporters-analyse-video-technology-football.html?ns_mchannel=rss&ns_campaign=1490&ito=1490",
"ampUrl": "https://www.dailymail.co.uk/sport/football/article-6729017/amp/Is-VAR-working-change-Reporters-analyse-video-technology-football.html",
"cdnAmpUrl": "https://www-dailymail-co-uk.cdn.ampproject.org/c/s/www.dailymail.co.uk/sport/football/article-6729017/amp/Is-VAR-working-change-Reporters-analyse-video-technology-football.html"
}
],
"urlErrors": [
{
"errorCode": "NO_AMP_URL",
"errorMessage": "No AMP URL for the request URL.",
"originalUrl": "https://www.talouselama.fi/uutiset/te/2223797c-6be5-3be1-b1aa-f774ff23d63e"
}
]
}
I am using FineUploader 5.13.0 with the Azure Blob Storage end point.
I have it successfully uploading files directly to blob storage, and also successfully hitting my web server success endpoint when the upload is concluded.
However, I am looking for a way to include custom data in the post to the success endpoint.
This bit in the documentation seems to imply that it is possible.
Under the section "Optional server-side tasks" for "uploadSuccess.endpoint", it says it will send
"Any parameters/form fields you have associated with the file".
However, I just cannot seem to figure out how to do that.
This issue seems to refer to it, but doesn't give enough info.
https://github.com/FineUploader/fine-uploader/issues/1313
Note, I am not referring to the feature to hook into existing HTML forms as explained on this documentation page:
"Integrating with Existing HTML Forms"
https://docs.fineuploader.com/branch/master/features/forms.html
You might be looking for FineUploader's Request params. This allows you to add extra form data.
Eg:
new qq.FineUploader({
// elided
request: {
params: {
testing: "THIS IS A TEST"
}
}
});
This will show up in the multi-part body of the request:
AWS Elastic Load Balancer listening through HTTPS (443) using SSL and redirecting requests to EC2 instances through HTTP (80), with IIS hosting a .net webapi application, using swashbuckle to describe the API methods.
Home page of the API (https://example.com) has a link to Swagger documentation which can bee read as https://example.com/swagger/ui/index.html when you hove over on the link.
If I click on the link it redirects the request on the browser to http://example.com/swagger/ui/index.html which displays a Page Not Found error
but if I type directly in the browser URL https://example.com/swagger/ui/index.html then it loads Swagger page, but then, when expanding the methods an click on "Try it out", the Request URL starts with "http" again.
This configuration is only for Stage and Production environments. Lower environments don't use the load balancer and just use http.
Any ideas on how to stop https being redirected to http? And how make swagger to display Request URLs using https?
Thank you
EDIT:
I'm using a custom index.html file
Seems is a known issue for Swashbuckle. Quote:
"By default, the service root url is inferred from the request used to access the docs. However, there may be situations (e.g. proxy and load-balanced environments) where this does not resolve correctly. You can workaround this by providing your own code to determine the root URL."
What I did was provide the root url and/or scheme to use based on the environment
GlobalConfiguration.Configuration
.EnableSwagger(c =>
{
...
c.RootUrl(req => GetRootUrlFromAppConfig(req));
...
c.Schemes(GetEnvironmentScheme());
...
})
.EnableSwaggerUi(c =>
{
...
});
where
public static string[] GetEnvironmentScheme()
{
...
}
public static string GetRootUrlFromAppConfig(HttpRequestMessage request)
{
...
}
The way I would probably do it is having a main file, and generating during the build of your application a different swagger file based on the environnement parameters for schemes and hosts.
That way, you have to manage only one swagger file accross your environments, and you only have to manage a few extra environnement properties, host and schemes (if you don't already have them)
Since I don't know about swashbuckle, I cannot answer for sure at your first question (the redirect)
Recently I started working with Google Place API. I have created one server key for my current project. As I have to use Place API so I turned it on in Service page.
When I am using the following URL in my browser, I get the desired output in the browser.
https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY
But if I use the URL above in my current C++ project or with the curl command on ubuntu terminal, I get the following error.
{
"error_message" : "An internal error was found for this API project.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
What should I do to correct this behaviour?
if you used the uri
https://maps.googleapis.com/maps/api/place/textsearch/json?query=restaurants+in+Sydney&sensor=true&key=MY_API_KEY
you sending a request to google, logging for the account with the key 'MY_API_KEY'
i guess you need to register for a key and use it as parameter value