MS graph update subscription (PATCH) not working - call

I have created a call record subscription and it works fine.
While updating the same subscription from java code using Google http client com.google.api.client.http.* , i am getting error java.lang.IllegalArgumentException: HTTP method PATCH not supported.
Does Microsoft support PATCH request using google client ?
Could anyone help ?
Thanks

Related

Error Calling an Azure Function App from a Logic App

I've created two .NET core (standard 2.0) Function Apps in Visual Studio and deployed them to Azure and successfully consumed them from Logic Apps. Although I had to pass all my parameters in the body as I couldn't create a swagger definition (API definition gives the message - Function API definition (Swagger) feature is not supported for beta runtime currently.)
This week however when I try to use a new function app in a new logic app I get a message –
Failed to fetch swagger with error message: Unable to get
https://functionAppName.azurewebsites.net/admin/host/swagger?code=Zmjahr48TCU32BbwBgQ8Q7XG66sXzyDbV4A6ZBK230W08MBy6mkmUg==.
Ensure you have CORS enabled on the endpoint and are calling a valid
HTTPS endpoint.
I could see in dev tools that the preflight request was failing so I tried a fix whereby I removed all the Allowed Origins in the CORS definition for the function App. Saved and added an entry for * (then save and restart app). After doing this I get a new error -
Failed to fetch swagger with error message: Failed to fetch. Ensure
you have CORS enabled on the endpoint and are calling a valid HTTPS
endpoint.
In dev tools I see it’s getting a 404 not found on the swagger definition.
So I removed the FUNCTIONS_EXTENSION_VERSION beta and created an API definition and now I can add it as an action in my Logic App but I can’t invoke it as I get the error:
"message": "'MethodName' can't be invoked from Azure WebJobs SDK. Is
it missing Azure WebJobs SDK attributes?"
In the meantime the initial Function Apps I created in the same subscription are still working (even after republishing from VS). The new function apps work successfully in the test window and when called via postman, so the apps themselves are fine. It's just the definition that's not working which stops me adding them as an action in a Logic App
What's going wrong with the new Function Apps and how can the original ones still be working?
You should add this to CORS in your Azure functions settings
https://ema.hosting.portal.azure.net

Ionic App aborting request with response status -1

I'm using Ionic platform for my mobile application. Using angular
$http for sending requests to server.
Intermittently when Mobile app tries to access server $http goes to it's errorCallback with response status -1 only no other
data.
When I check log on server, not able to see any hit.
I've changed timeout of application to 2 minutes using interceptors.
I have used chrome debugger but it won't show anything apart from
request it forms, shows nothing in response and preview columns.
I got that in Ionic we use pre-flight to check if server is alive
before sending actual request. But it's for CORS; we have enabled
CORS on server and thats why app is working good since last 15 days.
Thought of using network packet tracer tool but if call not logged on
server no use of it. as Status -1 says $http aborted the request.
My Question is why it's aborting when I click once and do send
when I click same button again.
Please me help to figure out an issue.
After lots of debugging and surfing over internet for issue.
I guess that an issue was like mobile app sending pre-flight messages and so $http aborting the request and even some time Server played a culprit here how will tell you;
We have server hosted on AWS in where we had Load balancer in different zone and actual API server is in different zone. After changing them to same zone ask, production people to test now they are not getting this issue.
The another reason was we were using unstable mobile networks to test.
If any one have any thing else on this please let me know.

Google Cloud Messaging Returns 'to' on localhost

I am trying to send out a push notification through Google cloud messaging and using this as a guide
https://developers.google.com/web/fundamentals/getting-started/push-notifications/?hl=en
I get the endpoint from chrome but when I try to do a CURL call to the endpoint id (using my project number in the manifest file, and my api key), I don't get a meaningful message back. Not even a error.
All I get is 'to' as output. I am using CURL on Windows so I don't know if there is any additional info in the headers (is there?).
Has anyone any clue what 'to' is, and what can I do to fix this.
I am running this test on my localhost on an apache server.
Thanks

Force.com callout: Is there a way to get the full response from the target server

When calling a web service from Force.com, I am getting:
System.CalloutException: Web service callout failed: Unexpected
element. Parser was expecting element
'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
The network guys at the other end has asked to see the full response that Salesforce is getting from their server.
Is there a way to achieve that? I have tried running with debug level 'Finest' from execute anonymous, but that yields the same little message with no further detail.
The message you are getting is because an error is generated as Saleforce is trying to parse the response is and it isn't logged unfortunately.
The parsing error is happening because instead of a SOAP message response you are getting an HTML page. This usually happens when you are accessing a service that is protected behind a firewall. Which means you may be able to see the service when browsing on your computer but remember that Salesforce is outside of your firewall and thus any communication by Salesforce to your service will be blocked.
Couple of ways to address this but this wiki topic from Salesforce best covers the options:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_om_outboundmessaging_security.htm
The above is specific to outbound messaging but essentially the technology issues are the same.
Don't forget that Apex includes an HttpRequest Class that works as a lower layer than the SOAP APIs. You should be able to write up a test method that sends a hard-coded XML request to the server and dumps the HttpResponse so you can see it.
Adding my own best answer, based on some internet research:
You can use an external tool like Runscope as a webservice proxy to automatically forward requests and pass through responses and view the XML SOAP messages. This is not a native solution on SFDC but it does do the job.
https://www.runscope.com/
The issue is that Force.com is trying to parse a SOAP response that's actually just HTML. This happens sometimes when an error occurred server-side and the response is meant for a browser to display, rather than sending back an exception report via a properly formatted SOAP response.
If they can't figure out why they are not sending back a consumable SOAP response, then you can try using other tools (outside of Force.com) to make the same webservice call from your browser and then see what the HTML actually says on return.

Open Graph Action POST fails when called thru a google app engine based unpaid instance

urlopen fails with a 500 code and '{"error_code":1,"error_msg":"An unknown error occurred"}' error from Facebook when posting an Open Graph Action. I can get the code to work with other posts (e.g. posting a comment on a status using the graph API works fine). I can also get this action-post to work using curl. So this seems like a urllib2.urlopen issue when posting a form-data with a URL as one of the values.
Graph api post that works with curl :
curl -F 'access_token=nnnnnn' -F 'object=https://abc.com/123' \
'https://graph.facebook.com/me/namespace:action' -k
Same Graph api post thru urllib2 which gives the error :
from urllib2 import urlopen, Request, URLError
request = Request (url='http://graph.facebook.com/me/namespace:action';,
data = urllib.urlencode(
{'object':'https://abc.com/123',
'access_token':'nnnnnnnn'
},
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
)
response = urlopen (request)
What could I be doing wrong ? (I am new to urllib2.urlopen. Btw, I originally tried urlfetch.fetch thru the urlfetch python module. That did not work either). I am using this thru goole app engine.
After a fair amount of digging/trial-error, finally managed to solve this.
This is not an issue with urllib urlopen, but more of a Google App Engine nuance where when an action post on an open Graph URL is called - it causes Facebook to trigger a 'get' on the Object URL (synchronously).
So essentially the get is being called on app engine app while an active instance is already calling the FB graph URL. I am currently using an unpaid instance and this is causing an unexpected behavior such that FB to fails the OG post (I see the get on the logs going thru successfully, while the active post, so not sure what causes FB to fail - anybody with an insight, please share).
I got around this by 'taskqueue'ing urlopen/OG-action-post - and when this is called the second time (FB apparently caches the object the first time) it succeeds.
If anybody needs more details, get in touch and am more than happy to save you all the time and pain that I have already gone thru..

Resources