Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hello, I am trying to implement webhooks, but I am encountering some issues.
As you can see I have 1 developer user added, and I have also managed to get my site enabled. I used Generate Access Token, so that's why I didn't go through the OAuth process.
<%
import Foundation
import SwiftEngine
import SwiftyJSON
let reqVal = Request.server["REQUEST_METHOD"] ?? ""
if(reqVal == "GET")
{
let params = Request.get
let challengeCode = params["challenge"]!
Response.write(challengeCode);
}
else
{
var path = "data.txt"
let text = "some text"
try! text.write(toFile:path, atomically: false, encoding: String.Encoding.utf8 )
Response.write("Done");
}
%>
Above is my code. Upon a GET request it validates the Webhook by echoing the Dropbox challenge.
The else clause handles every other HTTP request, and thus should handle the POST notification that is supposed to be sent upon a file change; this isn't working. Essentially, upon a POST the code will write to a file in the current local directory of my server (not dropbox) called data.txt. I used Charles to see if it was just Dropbox or if the handler wasn't working.
the POST succeeded and wrote to the file as expected. For that reason, I think I either misunderstood something when reading the docs or Dropbox isn't even making a request for some reason. Any help on this would be much appreciated.
On point 1 I am making the changes in the correct account. I am also doing it in the folder. I don't think the post is even getting run though, which is why I'm a little confused, espsecially since it runs when i make a POST request manually. Theoretically, it should send a POST if I create or alter a file in the folder right?
ok so i have verified that dropbox doesn't seem to be making any sort of HTTP request to the page. I added a log that runs if any request is made, but it isn't even being run. Does the URI need to be HTTPS or something, because I don't see any other reason it shouldn't be sending any data.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!