cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Javascript SDK - SharingSharedLinkSettings

Javascript SDK - SharingSharedLinkSettings

find-bijan
Explorer | Level 4
Go to solution

I'm developing a beat selling website for a producer and decided to use Dropbox as a digital download file storage. The producer will be able to send download links automatically and manually to their clients. I know I can not make individual shared links for everyone that buys a beat so I'll be using one shared link by limiting access to the link and expiring each active link every 10 days. The issue I'm running in to is the inability to set the expiration settings from my code. The link is created but the expiration settings are not.

 

I've tried "{settings: {expires: "date"}}" and other combinations as well as many input formats but I just can't find the right syntax for the object. The code below was my final try before this post - I know it's the furthest thing from correct but I literally tried everything I could imagine. I'd appreciate the help, thanks

dbx.sharingCreateSharedLinkWithSettings({path: '/allherdemo.mp3'},{expires:"12/10/2017"})
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log(error);
    });
1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

It looks like there a few small things to fix in your code:
- the parameters should be passed in one dict in a single argument
- you do need the nested 'settings' key
- you need to provide the date in the "%Y-%m-%dT%H:%M:%SZ" format

 

So, it should look like this: 

dbx.sharingCreateSharedLinkWithSettings({path: '/allherdemo.mp3', settings: {expires: "2017-12-10T00:00:00Z"}})
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log(error);
    });

View solution in original post

1 Reply 1

Greg-DB
Dropbox Staff
Go to solution

It looks like there a few small things to fix in your code:
- the parameters should be passed in one dict in a single argument
- you do need the nested 'settings' key
- you need to provide the date in the "%Y-%m-%dT%H:%M:%SZ" format

 

So, it should look like this: 

dbx.sharingCreateSharedLinkWithSettings({path: '/allherdemo.mp3', settings: {expires: "2017-12-10T00:00:00Z"}})
    .then(function(response) {
      console.log(response);
    })
    .catch(function(error) {
      console.log(error);
    });
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?