Posts

Showing posts with the label Api

C# How To Use WM_GETTEXT / GetWindowText API / Window Title

Answer : public class GetTextTestClass{ [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage", CharSet = System.Runtime.InteropServices.CharSet.Auto)] public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam); [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)] public static extern IntPtr SendMessage(int hWnd, int Msg, int wparam, int lparam); const int WM_GETTEXT = 0x000D; const int WM_GETTEXTLENGTH = 0x000E; public string GetControlText(IntPtr hWnd){ // Get the size of the string required to hold the window title (including trailing null.) Int32 titleSize = SendMessage((int)hWnd, WM_GETTEXTLENGTH, 0, 0).ToInt32(); // If titleSize is 0, there is no title so return an empty string (or null) if (titleSize == 0) return String.Empty; StringBuilder title = new StringBuilder(...

Bulk POST/PUT API Requests Using POSTMAN Or Any Other Means

Image
Answer : Never mind I figured out a way to use postman's collection runner to accomplish the same. For those who struggled like the way I did, here is how to use that feature and its even easier to substitute values to your url on the go. First create a request in Postman: Below is a screenshot for Example : Now the requirement is to post the below url: https://someApiPOSTRequest/clientAssign?auth=123|asdf&otherParamsList=123Params&someOtherParams={{VariableFromFile}}&additionalParams=hardcodedOnURL with values being substituted for {{VariableFromFile}} from the csv file you will need to upload. Your csv should be formatted as below, where the header should have the same variable name used on your url: Click on the '>' button shown below beside Example folder and click on 'Run' to open the same on Collection runner window of postman: Once the Collection Runner window opens up, click on select file option to upload your csv ...

API For Trust.salesforce.com

Answer : I've set up IFTTT to monitor the trust RSS feed and text me when there are issues. Sometimes I get alerts after the degradation is over because IFTTT runs in batches every 15 or 30 minutes. It still works pretty well to let me know when there is an issue. It makes me look smart when someone asks "is there a problem with Salesforce?" Try this modifying this recipe: https://ifttt.com/recipes/169172-performance-degradation-on-salesforce-na13 There is a public facing API: https://api.status.salesforce.com/v1/docs/ You can make a request such as the following to obtain parseable json with status information, degradation, outage, etc, info: $ curl https://api.status.salesforce.com/v1/instances/NA48/status You can also install SalesforceA for either Android or iOS to get access to the latest status, view user information, unlock, freeze/unfreeze, activate/deactivate, reset passwords, etc, from your mobile phone. Salesforce just released a native port of th...

Call Another Rest Api From My Server In Spring-Boot

Answer : This website has some nice examples for using spring's RestTemplate. Here is a code example of how it can work to get a simple object: private static void getEmployees() { final String uri = "http://localhost:8080/springrestexample/employees.xml"; RestTemplate restTemplate = new RestTemplate(); String result = restTemplate.getForObject(uri, String.class); System.out.println(result); } Instead of String you are trying to get custom POJO object details as output by calling another API/URI , try the this solution. I hope it will be clear and helpful for how to use RestTemplate also, In Spring Boot , first we need to create Bean for RestTemplate under the @Configuration annotated class. You can even write a separate class and annotate with @Configuration like below. @Configuration public class RestTemplateConfig { @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) { return builder.build(); } } The...

Address Validation Using Google Maps API

Answer : The answer probably depends how critical it is for you to receive support and possible customization for this service. Google can certainly do this. Look into their XML and Geocoding API's. You should be able to craft an XML message asking Google to return Map coordinates for a given address. If the address is not found (invalid), you will receive an appropriate response. Here's a useful page: http://code.google.com/apis/maps/documentation/services.html#XML_Requests Note that Google's aim in providing the Maps API is to plot addresses on actual maps. While you can certainly use the data for other purposes, you are at the mercy of Google should one of their maps not exactly correspond to your legal or commercial address validation needs. If you paid for one of the services you mentioned, you would likely be able to receive support should certain addresses not resolve the way you expect them to. In other words, you get what you pay for ;) . If you have the t...