Sending the Object
#
How to contact the APIOnce we have assigned the API object to a variable describing our model, we send it to SkyCiv for analysis via the API. This is achieved by the use of a POST request. If you'd like to learn more about HTTP methods, w3schools.com provides a great definition.
There are various ways to contact the API:
- Using the packages developed by the SkyCiv team (highly recommended).
- Download the SkyCiv API file and include it in you project.
- Constructing the call manually.
#
Packages by the SkyCiv TeamYou can view and learn about the available packages in the Packages section. We highly recommend this approach as we will continue to improve these packages to provide useful tools. This method is common industry practice as it helps keep your code clean and easy to read.
Although it may initially take longer to get setup, once you have an understanding of how package managers work (which we have provided) it will make future projects very quick and robust.
#
Including the SkyCiv API fileAlternatively, you can manually include the SkyCiv API file via GitHub in your project which will make the request for you (by calling the skyciv.request()
method). For example, if you're using JavaScript then you can find the module here: https://api.skyciv.com/dist/v3/javascript/skyciv.js
To use this JavaScript module, the request()
function would be called as follows:
#
Manually calling the APIYou can manually make a HTTP/HTTPS POST Request to either of the following endpoints depending on whether you wish to use HTTP or HTTPS:
HTTPS: https://api.skyciv.com:8085/v3
HTTP: http://api.skyciv.com:8086/v3
The following links provide a live demonstration of how to achieve this across various languages. Just add your own credentials to the auth
object!
Comments are provided to help you understand exactly what is happening. Notice that after removing the comments and print statements, the actual code is only a fraction of the file.
- Node.js
- HTML/JavaScript
- Python 2 - Note: No longer supported by the Python Software Foundation, Python 3 is preferred.
- Python 3
- C#
The code located in the above links has also been provided below.
- Node.js
- HTML/JS
- JQuery
- Python
- C#