I have come across some people asking for retrieving the item id of Folder based on the folder url.
In this code, I 'm going to show you simple url used to retrieve that ID,
http://sharepointsite/_api/web/GetFolderByServerRelativeUrl('/Library/Folder')/listitemallfields/id
ListItemAllFields - Returns the list item properties of the folder item.
If you want to use the REST API in Add-in development, I have just changed the hardcoded value from the url,
- var folder id = _spPageContextInfo.webAbsoluteUrl + "/_api/web/GetFolderByServerRelativeUrl('" + ctx.rootFolder + "')/listitemallfields/id";