Office 365 Basic Operations Using REST API In SharePoint Online 2013

REST API supports only the format given below, so please be careful before executing your code.

The method given below will retrive all the folders under this Web.
  1. url: http://site url/_api/web/folders  
  2. method: GET  
  3. headers:  
  4. Authorization"Bearer " + accessToken  
  5. accept: "application/json;odata=verbose"   
Example

Copy the format given below in your Browser and you will get the JSON data, which is given below.
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <feed xml:base="https://gowthamr.sharepoint.com/sites/TestSite/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">  
  3.     <id>f299537c-a7f0-4498-97f6-2406f8e5381e</id>  
  4.     <title />  
  5.     <updated>2017-03-14T03:05:58Z</updated>  
  6.     <entry>  
  7.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')</id>  
  8.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  9.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')" />  
  10.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/Activities" />  
  11.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/Files" />  
  12.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/ListItemAllFields" />  
  13.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/ParentFolder" />  
  14.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/Properties" />  
  15.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/StorageMetrics" />  
  16.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_catalogs')/Folders" />  
  17.         <title />  
  18.         <updated>2017-03-14T03:05:58Z</updated>  
  19.         <author>  
  20.             <name />  
  21.         </author>  
  22.         <content type="application/xml">  
  23.             <m:properties>  
  24.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  25.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  26.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  27.                 <d:Name>_catalogs</d:Name>  
  28.                 <d:ProgID m:null="true" />  
  29.                 <d:ServerRelativeUrl>/sites/TestSite/_catalogs</d:ServerRelativeUrl>  
  30.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:09Z</d:TimeCreated>  
  31.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:09Z</d:TimeLastModified>  
  32.                 <d:UniqueId m:type="Edm.Guid">c1a58d90-5c0d-4fe9-af5b-0db8fb43fb17</d:UniqueId>  
  33.                 <d:WelcomePage></d:WelcomePage>  
  34.             </m:properties>  
  35.         </content>  
  36.     </entry>  
  37.     <entry>  
  38.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')</id>  
  39.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  40.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')" />  
  41.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/Activities" />  
  42.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/Files" />  
  43.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/ListItemAllFields" />  
  44.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/ParentFolder" />  
  45.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/Properties" />  
  46.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/StorageMetrics" />  
  47.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/FormServerTemplates')/Folders" />  
  48.         <title />  
  49.         <updated>2017-03-14T03:05:58Z</updated>  
  50.         <author>  
  51.             <name />  
  52.         </author>  
  53.         <content type="application/xml">  
  54.             <m:properties>  
  55.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  56.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  57.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  58.                 <d:Name>FormServerTemplates</d:Name>  
  59.                 <d:ProgID m:null="true" />  
  60.                 <d:ServerRelativeUrl>/sites/TestSite/FormServerTemplates</d:ServerRelativeUrl>  
  61.                 <d:TimeCreated m:type="Edm.DateTime">2017-03-07T17:21:45Z</d:TimeCreated>  
  62.                 <d:TimeLastModified m:type="Edm.DateTime">2017-03-07T17:21:45Z</d:TimeLastModified>  
  63.                 <d:UniqueId m:type="Edm.Guid">e32bf039-6596-482e-8e5c-0df417fbaa24</d:UniqueId>  
  64.                 <d:WelcomePage></d:WelcomePage>  
  65.             </m:properties>  
  66.         </content>  
  67.     </entry>  
  68.     <entry>  
  69.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')</id>  
  70.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  71.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')" />  
  72.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/Activities" />  
  73.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/Files" />  
  74.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/ListItemAllFields" />  
  75.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/ParentFolder" />  
  76.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/Properties" />  
  77.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/StorageMetrics" />  
  78.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SiteAssets')/Folders" />  
  79.         <title />  
  80.         <updated>2017-03-14T03:05:58Z</updated>  
  81.         <author>  
  82.             <name />  
  83.         </author>  
  84.         <content type="application/xml">  
  85.             <m:properties>  
  86.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  87.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  88.                 <d:ItemCount m:type="Edm.Int32">1</d:ItemCount>  
  89.                 <d:Name>SiteAssets</d:Name>  
  90.                 <d:ProgID m:null="true" />  
  91.                 <d:ServerRelativeUrl>/sites/TestSite/SiteAssets</d:ServerRelativeUrl>  
  92.                 <d:TimeCreated m:type="Edm.DateTime">2017-03-07T17:38:37Z</d:TimeCreated>  
  93.                 <d:TimeLastModified m:type="Edm.DateTime">2017-03-07T17:38:38Z</d:TimeLastModified>  
  94.                 <d:UniqueId m:type="Edm.Guid">9669972c-ac1f-4f47-bf23-14e87f8f4faa</d:UniqueId>  
  95.                 <d:WelcomePage></d:WelcomePage>  
  96.             </m:properties>  
  97.         </content>  
  98.     </entry>  
  99.     <entry>  
  100.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared Documents')</id>  
  101.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  102.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')" />  
  103.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/Activities" />  
  104.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/Files" />  
  105.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/ListItemAllFields" />  
  106.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/ParentFolder" />  
  107.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/Properties" />  
  108.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/StorageMetrics" />  
  109.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Shared%20Documents')/Folders" />  
  110.         <title />  
  111.         <updated>2017-03-14T03:05:58Z</updated>  
  112.         <author>  
  113.             <name />  
  114.         </author>  
  115.         <content type="application/xml">  
  116.             <m:properties>  
  117.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  118.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  119.                 <d:ItemCount m:type="Edm.Int32">1</d:ItemCount>  
  120.                 <d:Name>Shared Documents</d:Name>  
  121.                 <d:ProgID m:null="true" />  
  122.                 <d:ServerRelativeUrl>/sites/TestSite/Shared Documents</d:ServerRelativeUrl>  
  123.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:18Z</d:TimeCreated>  
  124.                 <d:TimeLastModified m:type="Edm.DateTime">2017-03-11T17:36:26Z</d:TimeLastModified>  
  125.                 <d:UniqueId m:type="Edm.Guid">6feedb83-a4f2-4ea9-9dae-23b616db38aa</d:UniqueId>  
  126.                 <d:WelcomePage></d:WelcomePage>  
  127.             </m:properties>  
  128.         </content>  
  129.     </entry>  
  130.     <entry>  
  131.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')</id>  
  132.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  133.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')" />  
  134.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/Activities" />  
  135.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/Files" />  
  136.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/ListItemAllFields" />  
  137.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/ParentFolder" />  
  138.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/Properties" />  
  139.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/StorageMetrics" />  
  140.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Lists')/Folders" />  
  141.         <title />  
  142.         <updated>2017-03-14T03:05:58Z</updated>  
  143.         <author>  
  144.             <name />  
  145.         </author>  
  146.         <content type="application/xml">  
  147.             <m:properties>  
  148.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  149.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  150.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  151.                 <d:Name>Lists</d:Name>  
  152.                 <d:ProgID m:null="true" />  
  153.                 <d:ServerRelativeUrl>/sites/TestSite/Lists</d:ServerRelativeUrl>  
  154.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:09Z</d:TimeCreated>  
  155.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:09Z</d:TimeLastModified>  
  156.                 <d:UniqueId m:type="Edm.Guid">5331e5b8-f6e8-42c4-9c87-567c486bc20a</d:UniqueId>  
  157.                 <d:WelcomePage></d:WelcomePage>  
  158.             </m:properties>  
  159.         </content>  
  160.     </entry>  
  161.     <entry>  
  162.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style Library')</id>  
  163.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  164.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')" />  
  165.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/Activities" />  
  166.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/Files" />  
  167.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/ListItemAllFields" />  
  168.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/ParentFolder" />  
  169.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/Properties" />  
  170.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/StorageMetrics" />  
  171.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/Style%20Library')/Folders" />  
  172.         <title />  
  173.         <updated>2017-03-14T03:05:58Z</updated>  
  174.         <author>  
  175.             <name />  
  176.         </author>  
  177.         <content type="application/xml">  
  178.             <m:properties>  
  179.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  180.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  181.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  182.                 <d:Name>Style Library</d:Name>  
  183.                 <d:ProgID m:null="true" />  
  184.                 <d:ServerRelativeUrl>/sites/TestSite/Style Library</d:ServerRelativeUrl>  
  185.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:12Z</d:TimeCreated>  
  186.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:12Z</d:TimeLastModified>  
  187.                 <d:UniqueId m:type="Edm.Guid">550ffa6e-7ec4-4dcb-9574-7d7914e1e085</d:UniqueId>  
  188.                 <d:WelcomePage></d:WelcomePage>  
  189.             </m:properties>  
  190.         </content>  
  191.     </entry>  
  192.     <entry>  
  193.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')</id>  
  194.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  195.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')" />  
  196.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/Activities" />  
  197.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/Files" />  
  198.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/ListItemAllFields" />  
  199.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/ParentFolder" />  
  200.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/Properties" />  
  201.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/StorageMetrics" />  
  202.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_vti_pvt')/Folders" />  
  203.         <title />  
  204.         <updated>2017-03-14T03:05:58Z</updated>  
  205.         <author>  
  206.             <name />  
  207.         </author>  
  208.         <content type="application/xml">  
  209.             <m:properties>  
  210.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  211.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  212.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  213.                 <d:Name>_vti_pvt</d:Name>  
  214.                 <d:ProgID m:null="true" />  
  215.                 <d:ServerRelativeUrl>/sites/TestSite/_vti_pvt</d:ServerRelativeUrl>  
  216.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeCreated>  
  217.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeLastModified>  
  218.                 <d:UniqueId m:type="Edm.Guid">a8baf11f-ff9c-4743-8d1d-93f81253e538</d:UniqueId>  
  219.                 <d:WelcomePage></d:WelcomePage>  
  220.             </m:properties>  
  221.         </content>  
  222.     </entry>  
  223.     <entry>  
  224.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')</id>  
  225.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  226.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')" />  
  227.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/Activities" />  
  228.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/Files" />  
  229.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/ListItemAllFields" />  
  230.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/ParentFolder" />  
  231.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/Properties" />  
  232.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/StorageMetrics" />  
  233.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/images')/Folders" />  
  234.         <title />  
  235.         <updated>2017-03-14T03:05:58Z</updated>  
  236.         <author>  
  237.             <name />  
  238.         </author>  
  239.         <content type="application/xml">  
  240.             <m:properties>  
  241.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  242.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  243.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  244.                 <d:Name>images</d:Name>  
  245.                 <d:ProgID m:null="true" />  
  246.                 <d:ServerRelativeUrl>/sites/TestSite/images</d:ServerRelativeUrl>  
  247.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeCreated>  
  248.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeLastModified>  
  249.                 <d:UniqueId m:type="Edm.Guid">f40e0f77-ef74-4218-8f8c-b3a5d3b186bd</d:UniqueId>  
  250.                 <d:WelcomePage></d:WelcomePage>  
  251.             </m:properties>  
  252.         </content>  
  253.     </entry>  
  254.     <entry>  
  255.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')</id>  
  256.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  257.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')" />  
  258.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/Activities" />  
  259.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/Files" />  
  260.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/ListItemAllFields" />  
  261.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/ParentFolder" />  
  262.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/Properties" />  
  263.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/StorageMetrics" />  
  264.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/SitePages')/Folders" />  
  265.         <title />  
  266.         <updated>2017-03-14T03:05:58Z</updated>  
  267.         <author>  
  268.             <name />  
  269.         </author>  
  270.         <content type="application/xml">  
  271.             <m:properties>  
  272.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  273.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  274.                 <d:ItemCount m:type="Edm.Int32">1</d:ItemCount>  
  275.                 <d:Name>SitePages</d:Name>  
  276.                 <d:ProgID m:null="true" />  
  277.                 <d:ServerRelativeUrl>/sites/TestSite/SitePages</d:ServerRelativeUrl>  
  278.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:21Z</d:TimeCreated>  
  279.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:27Z</d:TimeLastModified>  
  280.                 <d:UniqueId m:type="Edm.Guid">60b0e402-0bbf-46bd-961b-c405432268b5</d:UniqueId>  
  281.                 <d:WelcomePage></d:WelcomePage>  
  282.             </m:properties>  
  283.         </content>  
  284.     </entry>  
  285.     <entry>  
  286.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')</id>  
  287.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  288.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')" />  
  289.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/Activities" />  
  290.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/Files" />  
  291.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/ListItemAllFields" />  
  292.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/ParentFolder" />  
  293.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/Properties" />  
  294.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/StorageMetrics" />  
  295.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_cts')/Folders" />  
  296.         <title />  
  297.         <updated>2017-03-14T03:05:58Z</updated>  
  298.         <author>  
  299.             <name />  
  300.         </author>  
  301.         <content type="application/xml">  
  302.             <m:properties>  
  303.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  304.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  305.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  306.                 <d:Name>_cts</d:Name>  
  307.                 <d:ProgID m:null="true" />  
  308.                 <d:ServerRelativeUrl>/sites/TestSite/_cts</d:ServerRelativeUrl>  
  309.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:08Z</d:TimeCreated>  
  310.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:08Z</d:TimeLastModified>  
  311.                 <d:UniqueId m:type="Edm.Guid">7fde8e37-0a23-454e-bf3b-d7b69f448121</d:UniqueId>  
  312.                 <d:WelcomePage></d:WelcomePage>  
  313.             </m:properties>  
  314.         </content>  
  315.     </entry>  
  316.     <entry>  
  317.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')</id>  
  318.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  319.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')" />  
  320.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/Activities" />  
  321.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/Files" />  
  322.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/ListItemAllFields" />  
  323.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/ParentFolder" />  
  324.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/Properties" />  
  325.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/StorageMetrics" />  
  326.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/IWConvertedForms')/Folders" />  
  327.         <title />  
  328.         <updated>2017-03-14T03:05:58Z</updated>  
  329.         <author>  
  330.             <name />  
  331.         </author>  
  332.         <content type="application/xml">  
  333.             <m:properties>  
  334.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  335.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  336.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  337.                 <d:Name>IWConvertedForms</d:Name>  
  338.                 <d:ProgID m:null="true" />  
  339.                 <d:ServerRelativeUrl>/sites/TestSite/IWConvertedForms</d:ServerRelativeUrl>  
  340.                 <d:TimeCreated m:type="Edm.DateTime">2017-03-07T17:21:46Z</d:TimeCreated>  
  341.                 <d:TimeLastModified m:type="Edm.DateTime">2017-03-07T17:21:46Z</d:TimeLastModified>  
  342.                 <d:UniqueId m:type="Edm.Guid">c9af8b0d-6f39-4328-bda9-d951f2a40c62</d:UniqueId>  
  343.                 <d:WelcomePage></d:WelcomePage>  
  344.             </m:properties>  
  345.         </content>  
  346.     </entry>  
  347.     <entry>  
  348.         <id>https://gowthamr.sharepoint.com/sites/TestSite/_api/Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')</id>  
  349.         <category term="SP.Folder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />  
  350.         <link rel="edit" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')" />  
  351.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Activities" type="application/atom+xml;type=feed" title="Activities" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/Activities" />  
  352.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Files" type="application/atom+xml;type=feed" title="Files" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/Files" />  
  353.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ListItemAllFields" type="application/atom+xml;type=entry" title="ListItemAllFields" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/ListItemAllFields" />  
  354.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentFolder" type="application/atom+xml;type=entry" title="ParentFolder" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/ParentFolder" />  
  355.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Properties" type="application/atom+xml;type=entry" title="Properties" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/Properties" />  
  356.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/StorageMetrics" type="application/atom+xml;type=entry" title="StorageMetrics" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/StorageMetrics" />  
  357.         <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folders" type="application/atom+xml;type=feed" title="Folders" href="Web/GetFolderByServerRelativePath(decodedurl='/sites/TestSite/_private')/Folders" />  
  358.         <title />  
  359.         <updated>2017-03-14T03:05:58Z</updated>  
  360.         <author>  
  361.             <name />  
  362.         </author>  
  363.         <content type="application/xml">  
  364.             <m:properties>  
  365.                 <d:Exists m:type="Edm.Boolean">true</d:Exists>  
  366.                 <d:IsWOPIEnabled m:type="Edm.Boolean">false</d:IsWOPIEnabled>  
  367.                 <d:ItemCount m:type="Edm.Int32">0</d:ItemCount>  
  368.                 <d:Name>_private</d:Name>  
  369.                 <d:ProgID m:null="true" />  
  370.                 <d:ServerRelativeUrl>/sites/TestSite/_private</d:ServerRelativeUrl>  
  371.                 <d:TimeCreated m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeCreated>  
  372.                 <d:TimeLastModified m:type="Edm.DateTime">2017-01-25T21:06:06Z</d:TimeLastModified>  
  373.                 <d:UniqueId m:type="Edm.Guid">d871eac7-a90c-443a-a1e6-e2c120615eb0</d:UniqueId>  
  374.                 <d:WelcomePage></d:WelcomePage>  
  375.             </m:properties>  
  376.         </content>  
  377.     </entry>  
  378. </feed>   
Source code

Copy the code given below and paste in your SharePoint ADD-IN.

Create a folder in SharePoint O365, using REST API.
  1. var hostweburl;  
  2. var appweburl;  
  3.   
  4.   
  5. $(document).ready(function () {  
  6.     
  7.   hostweburl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));  
  8.   appweburl = decodeURIComponent(getQueryStringParameter("SPAppWebUrl"));  
  9.   
  10.   $.getScript(hostweburl + "/_layouts/15/SP.RequestExecutor.js", runCrossDomainRequest);  
  11. });  
  12.   
  13.   
  14. function runCrossDomainRequest() {  
  15.   var executor = new SP.RequestExecutor(appweburl);   
  16.   executor.executeAsync({  
  17.      method: POST
  18.        url:appweburl+"/_api/web/folders"  
  19.         body: { '__metadata': { 'type''SP.Folder' }, 'ServerRelativeUrl''/Documents/CustomFolder'}  
  20.         Headers:   
  21.             Authorization: "Bearer " + accessToken  
  22.             X-RequestDigest: form digest value  
  23.             accept: "application/json;odata=verbose"  
  24.             content-type: "application/json;odata=verbose"  
  25.             content-length:length of post body  
  26.       success: successHandler  
  27.       error: errorHandler   
  28.   });  
  29. }  
  30.   
  31.   
  32. function getQueryStringParameter(paramToRetrieve) {  
  33.   var params = document.URL.split("?")[1].split("&");  
  34.   var strParams = "";  
  35.   for (var i = 0; i < params.length; i = i + 1) {  
  36.     var singleParam = params[i].split("=");  
  37.     if (singleParam[0] == paramToRetrieve) return singleParam[1];  
  38.   }  
  39. }   
Was my blog helpful?
 
Post your feedback here. Thanks for reading my blog.