Dropbox api: Can someone provide a HTTP request example? - http-headers

Could someone show me an example or a starting point on how Dropbox api http requests should look?
For example if I want to receive tokens how would the HTTP/1.1 request look like for this?
I'm planning on writing a program in C using sockets,
write(sockfd,buffer,strlen(buffer));
What should buffer look like to receive security tokens from dropbox? I hope I'm making sense.

The official SDKs on the Dropbox developer site each include working examples that you can work from:
https://www.dropbox.com/developers/reference/sdk

Related

How to figure out if the request coming to envoy (load balancer) is from a real user or google bot?

In our team we use envoyproxy (v1.18) as load balancer to handle requests (btw I'm a newbie in using envoy). Now I want to see if the request that reaches envoy, is coming from a real user or it's from a google bot. As I read in the official documentation, in each request's header, there is something called "user-agent" that adds something into the request header which can be used for this purpose but I don't exactly know how to use it. And also I'm not sure whether that's the best way to do it. I'd appreciate if anyone could guide me on this.

Working with Zabbix API from Delphi

can someone provide an example how to work with Zabbix API from Delphi?
Which Delphi component to use?
Thanks
Basically, the whole Zabbix API is just a JSON-RPC API, accessible via POST calls on one single URL. Further details about API can be found here:
https://www.zabbix.com/documentation/2.4/manual/api
As can be seen, the only thing you have to do is to make a POST to:
http://company.com/zabbix/api_jsonrpc.php HTTP/1.1
Content-Type: application/json-rpc
{"jsonrpc":"2.0","method":"apiinfo.version","id":1,"auth":null,"params":{}}
Now, it does not matter whether you use delphi or not, you only need a component that can build a HTTP request and parse HTTP respone. I found this question, that may be helpful for you, since it seems to handle HTTP POSTs in Delphi.
What’s the simplest way to call Http POST url using Delphi?
At this time, i don't know any existing Delphi library that would do the magic for you.

Is it ok to use http dropbox file links instead of https?

Using dropbox '/media' API call I've obtained a direct https file link. Something like this:
https://dl.dropboxusercontent.com/1/view/asdfasdfasdfasd/file.ext
Then I've changed it from 'https' to 'http' and successfully downloaded the file. Obviously enough, the modified link looked like this:
http://dl.dropboxusercontent.com/1/view/asdfasdfasdfasd/file.ext
My question is wether it's ok to use http links or not? Is it some sort of dropbox bug or a hack?
Strange. I get a 400 error when I try to do the same thing.
Even if HTTP is working for you, I'd advise against using it. Someone eavesdropping on your traffic could learn the link to the file, and it's also possible for someone to impersonate dropboxusercontent.com and send you the wrong data.
It's probably best to stick with HTTPS.

API subdomain - what should be done with the root?

Let's say I have a subdomain that I use for my site's API: http://api.example.com/
All of the API's methods are accessible as URL segments such as http://api.example.com/some_method, so the root itself isn't used for anything.
Should it redirect to http://example.com/, redirect to a 404 page like Twitter, emit a basic response in the format of the API with a short message, or just have it send an empty response?
Are there any resources out there (articles, etc.) with any other possible suggestions?
I think that's up to you. In a RESTful API, the root would be the starting point for visitors to learn how to operate your system (HATEOAS). But since you talk about /some-method, you're probably not using the REST architectural style, so that's not applicable.
I would avoid the empty response. Maybe a short message pointing to documentation for the API? It really depends a lot on how the rest of your system is designed, so it's hard to give "correct" advice.

hotfile uploader

i want to write a cli program that uploads files to hotfile.com and returns the download links what is the best language to write it in and can anybody give me some hints how to send the file?
Thanks
You could write it in any language which could to make HTTP requests, as C# or Java. Like most websites interactions, that language will need to support some kind of CookieContainer in order to keep your session cookie after a web login, and to fake a POST with your file content. Fiddler can help you to understand how to send that information.
As this isn't a technical problem, you should first to ask if you can do that to site support personal, to do not break any TOS clause.