I have already downloaded JAVA API and PHP API because I kind of know Java and PHP but I don’t understand how to use them on my webpage
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi guys (@nundavid99, @newbie).
For some basic introduction, I’ll explain what does Java API, PHP API or any other API you find do. DigitalOcean has API which is public available to all their users.
Only thing you need to use it, is Token, which you generate from Control Panel. Go to it -> API -> Tokens. Generate New Token, select desired permissions (read and/or write) and give it name you want. Copy it and save on secure place now as it will not appear again.
You communicate with API via HTTP requests. To communicate via HTTP requests, you need to know “endpoints”. I would explain “endpoints” on something like links you need to call for some action. We have API Docs, which explains what features API does have and how you call them. So it only says what endpoints (“links”) it has. It will not learn you how to develop app for it, but it does have examples that can help a lot. You should get familiar with features of API before creating your own app.
Now to communicate with API via your app, you need to make functions in your application that will send HTTP requests to desired links. This is not hard, once you make first function, next are only copy-paste. But let’s agree, this is time consuming.
So, good community members made API Wrappers. You should look like on API Wrappers like libraries that have all that functions. You don’t need to write any function, you just call for example
CreateDroplet(args..)and it will create Droplet for you.
First thing you need to do is find API Wrapper for you language (follow link for list of it).
Let’s say we’re going to use API Wrapper for PHP called - API v2 client in PHP. When you open it you will see Sammy and some basic description with link
Visit Project. Click on it, it will redirect you to projects GitHub page.
Scroll down little and you will notice section starting with title
README.md. There you have everything about it, from how to install it and include in your project to what does it support. This is something I will not write here, follow it yourself, see the required dependencies, install it and see how is it working. ;)
Basically, you must find API Wrapper that have Docs. Docs are usually located in
README.mdof project. DO API Docs will not help with API Wrapper, as that docs explain how to use HTTP requests to do something with DO Droplets, etc… API Wrapper docs explains how to install/include it, and how to call functions.
API Wrappers can support all API functions, or less number of it. This is what you will find in docs. But it can’t have more functions than original DigitalOcean HTTP API.
Beside that you should know one thing. DigitalOcean only creates Ruby API Wrapper - droplet_kit and Go API Wrapper - godo. They’re officially supported by DigitalOcean and have all functions of HTTP API. All other Wrapper you find on the Internet, or DigitalOcean Projects site is made by some random person on the Internet who was kind enough to do it for us. It is not guaranteed that it does have Docs or it’ll get updates (new functions, bug fixes). So for them you will don’t find tutorials on DigitalOcean community or something like that. You must reefer to their docs.
When you go on DigitalOcean API docs, on right side you will see Examples. On bottom side of it you will see something like three tabs - CURL, RUBY, GO. Ruby and Go are basically some type tutorials how to use them. If you want to use them, you can use it as tutorial how to make something. For other languages, I already said what you need…
So first thing you should looking for in Wrapper Project Site is - Docs. Without docs you will have very hard time using it, especially as beginner.
Conclusion would be: Basically, you will have to find API Wrapper for your language, open their Project Page and read docs. Read it few times. It’ll give you idea how to use it. We can’t make you site for you, you will have to do it for yourself. If you need help including libraries, try to search how do you include any library for you language. Usually on same way you would include that Wrapper. If you stuck anywhere, you can raise a issue on Wrapper GitHub page, or ask here, maybe someone who used it will help you.
Maybe I wrote a long wall of text that didn’t help you, but I hope it is good read. It explains what does DO offers, what is API wrappers (or that JAVA API, PHP API) and what you need. You don’t have detailed steps but this for real beginners. Tl;dr: read docs - by reading docs, you will learn how to do it. :)
Learn one of the programming languages or hire a developer to do it for you.
Want to learn more? Join the DigitalOcean Community!
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Sign up now