Createfolder in dropbox using ionic

I want to create a folder in my dropbox,when my app links with my dropbox account…
I am able to login in my dropbox account using app,but I have also added the function to create folder ,but I am not able to create folder…
I found this from dropbox documentation and tried this…

login()-


login(){
 
  return new Promise((resolve, reject) => {
 
    let browser = this.iab.create(this.url, '_blank');
 
    let listener = browser.on('loadstart').subscribe((event: any) => {
 
      //Ignore the dropbox authorize screen
      if(event.url.indexOf('oauth2/authorize') > -1){
        return;
      }
 
      //Check the redirect uri
      if(event.url.indexOf(this.redirectURI) > -1 ){
        listener.unsubscribe();
        browser.close();
        let token = event.url.split('=')[1].split('&')[0];
        this.accessToken = token;
        resolve(event.url);
      } else {
        reject("Could not authenticate");
      }
 
    });
 
  });
}
 CreateFolder()
  {

    let args={
    "path": "/Homework/math",
    "autorename": false
}
    
  

   let headers = new Headers();
    headers.append('Authorization','Bearer'+this.accessToken);
    headers.append('Content-Type', 'application/json');
    console.log("created folder");
    return this.http.post('https://api.dropboxapi.com/2/files/create_folder',{headers:headers});

  }

I am getting console,log(“created folder”),but I am not able to create new folder

here I am calling login and createfolder function-

dropboxlogin()
{
    this.dropbox.login().then((success) => {
      this.navCtrl.push(DropboxloginPage);
			this.dropbox.CreateFolder();
		this.showToast("folder created");
    }, (err) => {
      console.log(err);
    });
 
  }


Please guide where I am wrong…

links-

Please edit your post, it is not very readable at the moment.
Use the </> button above the input field to format your code, command line output or error message (select the text first, then click the button or wrap it in ``` manually). Check the preview if it looks better. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Also add links to the documentation and libraries you are using please.
Adding your ionic info output also wouldn’t hurt.

I have edited my post…

Please find ionic info-

global packages:

@ionic/cli-utils : 1.3.0
Cordova CLI      : 7.0.1
Ionic CLI        : 3.3.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 6.2.3
Ionic Framework                 : ionic-angular 3.3.0

System:

Node       : v6.10.3
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
1 Like

I see a variable named args that is all dressed up but apparently has no date for the ball.

ok,thanks for that pointer,
so I added this…

  CreateFolder()
  {

    let args={
    "path": "/Homework/math",
    "autorename": false
}
  
     let headers = new Headers();
    headers.append('Authorization','Bearer'+this.accessToken);
    headers.append('Dropbox-API-Arg', JSON.stringify(args));
    headers.append('Content-Type', 'application/json');
    console.log("created folder");
    return this.http.post('https://api.dropboxapi.com/2-beta-2/files/create_folder',{headers:headers});

  }

But still the folder is not created in my dropbox

(Maybe silly question: Why are you not just using https://github.com/dropbox/dropbox-sdk-js?)