REST API DESIGN – Getting a resource through REST with different parameters but same url pattern

In my experience, GET /users/{id} GET /users/email/{email} is the most common approach. I would also expect the methods to return a 404 Not Found if a user doesn’t exist with the provided id or email. I wouldn’t be surprised to see GET /users/id/{id}, either (though in my opinion, it is redundant). Comments on the other … Read more

URL Scheme for Phone Call

The official standard for providing a telephone number as a URI is here: http://www.ietf.org/rfc/rfc3966.txt It basically says use tel: as the prefix, and start the number with +[international dialling code] before the number itself. You can put non-numeric characters as separators (e.g. -) but they must be ignored. So a London (UK) number might be: … Read more

The “prefs” URL Scheme is not working in iOS 10 (Beta 1 & 2)

Just replace prefs to App-Prefs for iOS 10 Below code works for iOS 8,9,10 Swift 3.0 and Xcode >= 8.1 if #available(iOS 10.0, *) { UIApplication.shared.openURL(URL(string: “App-Prefs:root=SOMETHING”)!) } else { UIApplication.shared.openURL(URL(string: “prefs:root=SOMETHING”)!) } Swift 2.2 if #available(iOS 10.0, *) { UIApplication.sharedApplication().openURL(NSURL(string:”App-Prefs:root=SOMETHING”)!) } else { UIApplication.sharedApplication().openURL(NSURL(string:”prefs:root=SOMETHING”)!) } Works for me. Happy Coding 😊

File Uri Scheme and Relative Files

In short, a file URL takes the form of: file://localhost/absolute/path/to/file [ok] or you can omit the host (but not the slash): file:///absolute/path/to/file [ok] but not this: file://file_at_current_dir [no way] nor this: file://./file_at_current_dir [no way] I just confirmed that via Python’s urllib2.urlopen() More detail from http://en.wikipedia.org/wiki/File_URI_scheme: “file:///foo.txt” is okay, while “file://foo.txt” is not, although some interpreters … Read more

How to handle with a default URL scheme

As you are mentioning AppleScript, I suppose you are working on Mac OS X. A simple way to register and use a custom URL scheme is to define the scheme in your .plist: <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>URLHandlerTestApp</string> <key>CFBundleURLSchemes</key> <array> <string>urlHandlerTestApp</string> </array> </dict> </array> To register the scheme, put this in your AppDelegate’s initialization: [[NSAppleEventManager … Read more