Google places API - Unable to add places using REST API - web-services

I am trying to add missing places using the REST API support offered by Places API. Referred the document made available in this link.
I am using POSTMAN Chrome app and I have tried to attempt adding missing places both using JSON and XML but in vain.
Here is the URL part,
https://maps.googleapis.com/maps/api/place/add/xml?key=AIzaSyBRRp4IKzIR4aqm3WWyOW2kMU9J8sVBQMc&sensor=false
And here is the POST part as XML
<PlaceAddRequest>
<location>
<lat>10.702860</lat>
<lng>77.759829</lng>
</location>
<accuracy>50</accuracy>
<name>Vannapatti Solar plant</name>
<phone_number>+91 98840 24699</phone_number>
<address>Vannapatti, Semmengarai po, Mulanur tk</address>
<type>Other</type>
<website>www.askjuno.com</website>
<language>ta</language>
</PlaceAddRequest>
And here is the response I get from google places api,
<?xml version="1.0" encoding="UTF-8"?>
<PlaceAddResponse>
<status>INVALID_REQUEST</status>
</PlaceAddResponse>
I checked for any missing attributes as quoted in the documentation however, I couldn't find anything missing. Any help would be deeply appreciated.

Related

Apache Nifi with Web Service

I'm trying to access a https site from Apache Nifi that has informations that I'm intrested at. The problem is it needs authentification to access the site.
With InvokeHTTP in Apache Nifi, we only can have the 'Basic Authentification' that I don't even know what stands for, but when inserting my logging identification, nothing changes. and I have a Access denied to that site (
<?xml version="1.0" encoding="UTF-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<m:code>-2147024891, System.UnauthorizedAccessException</m:code>
<m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message>
</m:error>
).
I've been looking for answers about a week ago, and I can't seem to find the answer anywhere,
That's why I'm asking you guys for help.
Thank you in advance.

How to use the url that came in response

Help to understand and direct what needs to be done further. I use the robot framework version 3.1.1 and the Python 2.7 programming language to write the autotest script, and now there is a task to develop a test that will work with POST / GET requests. So, I make a POST request to the system to initiate a payment. The answer comes that the payment has been created, but for all actions it is necessary to follow the link inside the answer.
Request:
Create Session allias URL
&{params}= Create Dictionary params1=value1 params2=value2
${resp}= Post Request allias /init_payment.php params=${params}
Should Be Equal As Strings ${resp.status_code} 200
Reply post response:
<?xml version="1.0" encoding="utf-8"?>
<response><pg_status>ok</pg_status><pg_payment_id>3016695</pg_payment_id><pg_redirect_url>https://test.paybox.money/payment.html?customer=028c44bf25b6be251199221d04b570c2</pg_redirect_url><pg_redirect_url_type>need data</pg_redirect_url_type><pg_salt>8OYUsodtnaTWKbOD</pg_salt><pg_sig>a26e61d6eb710c430d67150498d1f555</pg_sig></response>
How to show the framework so that it can go through the redirect url? I would be very grateful for your help.
The RequestsKeywors from the Robot Framework use Requests HTTP Client. Reading the quickstart from this library you can find that the response's contents is available in the text field.
${body}= ${resp.text}
Then you'd most likely want to parse the XML. You can use the XML library for that.
It will be something like
${root} = Parse XML ${body}
${link} = Get Element Text ${root} response/pg_redirect_url

How to access twilio's request from the aws api gateway mapping template?

I want to access my twilio get request (body, method, query etc.) via the aws api gateway but i don't know what to put in my aws api gateway in the mapping template to process it.
Any help will be highly appreciated.
Thanks.
If you want the response from the endpoint to be passed through as-is, you can use pass through mapping. Otherwise, you can use the mapping templates to customize the method response. Here is the Mapping Template Reference for API Gateway. Please let us know if you have any specific questions.
This is the most complete answer for AWS API Gateway to convert a form URL encoded POST, to a JSON payload...
Convert URL Encode to JSON NOTE: Scroll down to the last answer, as there are several updated to account for edge cases.
It's a lot of ceremony, using a language that I've never seen before, but at least it's readable. Far cry IMO from Azure functions where you simply get the request, and then manage it with the language that you are in.
This only gets you half way there however, you also have to add a mapping template to the Integration Response - but that template is simple and is referenced in the previous comment - repeated here for convenience
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<Response>
$inputRoot
</Response>
Since I'm using only responding to an SMS message - I added the following, and only returned a string from the function:
#set($inputRoot = $input.path('$'))
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Message>
<Body>
$inputRoot
</Body>
</Message>
</Response>

How to configure AWS S3 to allow POST to work like GET

Facebook states in their canvas setup documentation:
Our servers will make an HTTP POST request to this web address. The
retrieved result will be displayed within the Canvas frame on
Facebook.
My application is hosted on AWS S3 as a static website using the following CORS configuration:
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
</CORSConfiguration>
Already I'm having an issue here. GET requests work perfectly, but POSTing to http://my-bucket-name.s3-website-us-east-1.amazonaws.com kicks back:
<html>
<head>
<title>405 Method Not Allowed</title>
</head>
<body>
<h1>405 Method Not Allowed</h1>
<ul>
<li>Code: MethodNotAllowed</li>
<li>Message: The specified method is not allowed against this resource.</li>
<li>Method: POST</li>
<li>ResourceType: OBJECT</li>
<li>RequestId: 94159551A72424C7</li>
<li>HostId: +Lcz+XaAzL97Y47OZFvaTwqz4Z7r5koaJGHjZJBBMOTUHyThTfKbZG6IxJtYEbtsXWcb/bFxeI8=</li>
</ul>
<hr/>
</body>
</html>
Step 1: ^ I think I need to get this this working.
but wait, there's more
Facebook also requires a secure url. so for this, I went to cloudfront.
My configuration looks like this:
Just like when working with S3 directly, making GET requests to https://app-cloudfront-id.cloudfront.net/ works like a champ, POSTing, kicks back this:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>MethodNotAllowed</Code>
<Message>The specified method is not allowed against this resource.</Message>
<Method>POST</Method>
<ResourceType>OBJECT</ResourceType>
<RequestId>657E87A80AFBB3B0</RequestId>
<HostId>SY2g4smvhr06kAAQYVMsYeQZ+pSKbIIvsh/OaPBiMADGt5UKut0sXSZkFsnFmcRXQ2PFBVgPK4M=</HostId>
</Error>
Viewing the app on facebook.com shows:
Am I missing something?
so - I too thought this should be easy and well supported by AWS in 2016. Apparently, from all the reading I've done, we're wrong.
There's no way to serve the index page for a facebook app from s3 - with or without cloudfront.
It might be possible to serve the index page from an alternate origin (ie, your own httpd running somewhere) through cloudfront and everything else from s3 - but I haven't tried to dig into that rabbit hole. And if you're still having to run your own HA httpd...the complexity might not be worth it depending on your asset scale. ie http://www.bucketexplorer.com/documentation/cloudfront--how-to-create-distributions-post-distribution-with-multiple-origin-servers.html
you -can- use cloudfront in front of your own origin httpd serving the static content to take advantage of the cache and edge distribution - it will just forward the POST (and PUT etc) to your origin and bypass the cache edge.
these answers are old, circa 2011, - but I can't find any evidence that anything has changed with this.
https://forums.aws.amazon.com/thread.jspa?messageID=228988&#228988
https://forums.aws.amazon.com/thread.jspa?threadID=62525
Hopefully we can get some activity on this thread to prove me wrong, I could use this right now too.
I have a similar situation, using a single-page JS application, where all unresolved requests normally should be handled main page, /index.html.
The underlying problem is that S3 does not treat a POST like a GET. POST is a modifying request. There is a way to configure S3 to handle the POST, but that is intended for S3 modifications, not a read-only request like GET.
In order to handle the POST requests, I created an AWS CloudFront behavior that redirects the errors back to /index.html with a 200 HTTP response code. That way the POST request will go to the main page, and managed through the application. I have done the same thing for the 403 and 404 errors.
Edit the CloudFront distribution, go Error Pages, and create 3 different custom error responses as shown above.
FYI, you can easily add a dynamic side via CloudFront, avoiding all CORS issues.
CloudFront can mix both static and dynamic content through the behaviors.
Try creating the page as a response object to a Lambda function and use the ApiGateway to create a route to handle the page processing.
Leave the static content on S3, CloudFront for the SSL support and Lambda for any dynamic page processing.

WSO2 IS Generate a Metadata partner file

I am trying to use Oracle Weblogic server and add WSO2 IS as SAML 2.0 Web Single Sign-on Identity Provider Partner
however to acheive this i need to generate a metadata partner file or use the one from WSO2 IS.
how can i retrieve this information from WSO2 IS or at least generate on myself?
i used the example seen here:
http://tanyamadurapperuma.blogspot.co.uk/2013/09/configure-wso2-identity-server-saml2.html
however weblogic is saying it is unable to parse the XML,
Error Unable to parse XML
Error Create operation failed - no partner created.?
I as i know content in the blog is correct... And you can use the meta data file which in there. According to the error, it may be an issue with XML file.. I guess XML file in the blog has missed the Capital letters of the XML element. Could you try out by making them capital letters. Or else following
<md:EntityDescriptor entityID="https://localhost:9443/samlsso" validUntil="2023-09-23T06:57:15.396Z">
 <md:IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
 <md:KeyDescriptor use="signing">
 <ds:KeyInfo>
 <ds:X509Data>
 <ds:X509Certificate>MIICNTCCAZ6gAwIBAgIES343gjANBgkqhkiG9w0BAQUFADBVMQswCQYDVQQGEwJVUzELMAkGA1UE
 CAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxDTALBgNVBAoMBFdTTzIxEjAQBgNVBAMMCWxv
 Y2FsaG9zdDAeFw0xMDAyMTkwNzAyMjZaFw0zNTAyMTMwNzAyMjZaMFUxCzAJBgNVBAYTAlVTMQsw
 CQYDVQQIDAJDQTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzENMAsGA1UECgwEV1NPMjESMBAGA1UE
 AwwJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCUp/oV1vWc8/TkQSiAvTou
 sMzOM4asB2iltr2QKozni5aVFu818MpOLZIr8LMnTzWllJvvaA5RAAdpbECb+48FjbBe0hseUdN5
 HpwvnH/DW8ZccGvk53I6Orq7hLCv1ZHtuOCokghz/ATrhyPq+QktMfXnRS4HrKGJTzxaCcU7OQID
 AQABoxIwEDAOBgNVHQ8BAf8EBAMCBPAwDQYJKoZIhvcNAQEFBQADgYEAW5wPR7cr1LAdq+IrR44i
 QlRG5ITCZXY9hI0PygLP2rHANh+PYfTmxbuOnykNGyhM6FjFLbW2uZHQTY1jMrPprjOrmyK5sjJR
 O4d1DeGHT/YnIjs9JogRKv4XHECwLtIVdAbIdWHEtVZJyMSktcyysFcvuhPQK8Qc/E/Wq8uHSCo=
 </ds:X509Certificate>
 </ds:X509Data>
 </ds:KeyInfo>
 </md:KeyDescriptor>
 <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
 Location="https://localhost:9443/samlsso"
 ResponseLocation="https://localhost:9443/samlsso"/>
 <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
 Location="https://localhost:9443/samlsso"/>
 <md:SingleSignOnService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
 Location="https://localhost:9443/samlsso"/>
 </md:IDPSSODescriptor>
</md:EntityDescriptor>