1.11M Members

Developers: Connect with DaniWeb's API

DaniWeb offers a very robust API that is capable of duplicating most read capabilities of the website. Along with some limited write functionality, RESTful JSON objects, and OAuth 2.0, the possibilities are endless.

What is the purpose of our API?

DaniWeb's API allows you to write your own applications that leverage our entire database. You can essentially tap into every aspect of the raw database and build features and functionality that aren't currently implemented on the site. You can also write web-based applications, native desktop applications or even mobile applications that replicate nearly all of DaniWeb. Additionally, we make it easy to build Daniweb into your existing website or application.

How can I get started?

The simplest way to tap into our database is to make calls to our RSS feeds. Our RSS feeds return our latest articles optionally filtered by forum or article type. RSS feeds can be plopped into a syndication service or news reader, so you can read our latest content from within Microsoft Outlook, for example. If you want to add fresh content to your own website, you can easily make a request for a feed, and then loop through the list of articles, manipulate and display them however you like. Pretty much every programming language designed for the web has either native support or an easily accessible library to request and parse RSS feeds.

How does the API work?

For those of you who are more adventurous, you would want to play around with our API calls which return either JSON or JSONP. This is really the core of our API. JSON is a format that lends itself well to transmitting data objects between services and web applications. Your application would issue an HTTP request to our API, and the results will be returned in JSON format. JSON is a very portable, language-agnostic format and tools for parsing it are readily available for most modern programming languages. We try our best to ensure RESTful JSON objects, which essentially just means that we try to adhere to REST standards and principles. This makes it quick to pick up our API and begin doing some advanced things right away if you have previous REST API experience. If you are writing an AJAX-based application, we also offer support for JSONP, which is essentially a javascript technique that is used as an effective workaround for the same-origin policy which typically prevents web browsers from sending AJAX requests to a different domain and receiving a response. That mumbo jumbo just means that we support calling our API from browser-based languages such as javascript / jQuery.

What is OAuth and why do I want to use it?

Without OAuth, you can make API calls that request all of our publicly-accessible content, such as forums, members, articles and posts. However, if you want to write an application that caters to existing members, and you want your application to be able to access private areas of your end-users' profiles, or post on their behalf, then you need OAuth. OAuth allows your application to automatically detect which member is using it without the member having to share anything about themselves. Additionally, it allows your application to authenticate itself to our API with the DaniWeb member credentials of an end-user who is using it, without the need for the end-user to share their login credentials. Essentially, you would send your application's end-user to a webpage where we ask them if they authorize your application to access their account. Once they say yes, then your application is given an access token which is unique to your application and the individual end-user. Whenever you need to access the API on behalf of the end-user, you send the access token along with the request.

What is an example use case of OAuth?

As an example of a use case, OAuth offers the ability to create a Log In with DaniWeb feature to replace or extend your website's own signup and/or login mechanism. It can do this because the end-user just needs to click a single authorize button, and your application will be able to instantly gain access to their username, email address, avatar, and other profile settings. You'll have everything that you need to create your own well-rounded profile for them within your own database, on their behalf. This way, they don't need to fill out a sign up form on your site if they already have a DaniWeb profile. With over a million members to tap into, it's been proven that one-click signup can significantly increase your website's conversation rate!

I'm a visual person; Do you have any working examples?

Sometimes a picture speaks a thousand words, so here is a live, working php-based demo of our serverside OAuth implementation. Remember, you don't have to use php, but the majority of our official documentation is written in php. As mentioned above, our API also supports JSONP for AJAX support. Here is a javascript-based demo of our clientside implementation that has a slightly different flow than that used for non-browser based languages. You will notice that, as an end-user, once you authorize the demo to access your profile once, future accesses to your account from the demo application are entirely transparent.

What are the next steps?

If you plan to use OAuth, you must register your application in order to generate a client_id and client_secret unique to your application. The client ID and secret combination is necessary to authenticate yourself and your application when you ask your end-user for authorization to access their account. You can still make unauthenticated requests to our API without OAuth.

You must be a DaniWeb member in good standing in order to register an application or make any authenticated requests to our API.