# Code Examples

**URL:** https://community.dreamfactory.com/c/code-examples/22.md

[Latest](https://community.dreamfactory.com/latest.md) · [Categories](https://community.dreamfactory.com/categories.md) · [Tags](https://community.dreamfactory.com/tags.md)

---

## [About the Code Examples category](https://community.dreamfactory.com/t/about-the-code-examples-category/29)

<div class="topic-metadata">

**Author:** [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Replies:** 0

</div>

This category is for sharing code examples of how to use DreamFactory with languages and frameworks like Javascript, AngularJS, jQuery, Sencha, Objective-C, Java, C#, and more.

---

## [Swift + Alamofire: User Login & MySQL](https://community.dreamfactory.com/t/swift-alamofire-user-login-mysql/2435)

<div class="topic-metadata">

**Author:** [@samkirsten](https://community.dreamfactory.com/u/samkirsten)\
**Replies:** 5\
**Last updated:** [April 2, 2020, 5:51pm UTC](https://community.dreamfactory.com/t/swift-alamofire-user-login-mysql/2435 "2020-04-02T17:51:36Z")

</div>

Hi All, I've been working on a project using Swift and DreamFactory. I searched around online and couldn't find many concrete examples of accessing the DreamFactory API from Swift using Alamofire. I've added my code …

---

## [Consume web service with JAVA tutorial?](https://community.dreamfactory.com/t/consume-web-service-with-java-tutorial/1289)

<div class="topic-metadata">

**Author:** [@Reto](https://community.dreamfactory.com/u/Reto)\
**Replies:** 5\
**Last updated:** [September 10, 2018, 5:01pm UTC](https://community.dreamfactory.com/t/consume-web-service-with-java-tutorial/1289 "2018-09-10T17:01:13Z")

</div>

Hi all, With the SDK's you get a good jumpstart on how to consume the dreamfactory REST web services in applications/websites. I wonder if anyone knows a tutorial on how to consume the web service from JAVA? You'll…

---

## [1-to-Many JSON Structures & typing in SQL queries](https://community.dreamfactory.com/t/1-to-many-json-structures-typing-in-sql-queries/4591)

<div class="topic-metadata">

**Author:** [@tropicaltwin](https://community.dreamfactory.com/u/tropicaltwin)\
**Replies:** 1\
**Last updated:** [August 28, 2018, 10:04pm UTC](https://community.dreamfactory.com/t/1-to-many-json-structures-typing-in-sql-queries/4591 "2018-08-28T22:04:02Z")

</div>

Just installed DF to change an existing PHP-based website to use publicly exposed APIs rather than direct DB connectivity. Currently, I have custom written SQL queries either in the DB as a View or within the PHP pages.…

---

## [Swift 4.0 and dreamfactory](https://community.dreamfactory.com/t/swift-4-0-and-dreamfactory/4355)

<div class="topic-metadata">

**Author:** [@MrSpock](https://community.dreamfactory.com/u/MrSpock)\
**Replies:** 0\
**Last updated:** [March 30, 2018, 5:42pm UTC](https://community.dreamfactory.com/t/swift-4-0-and-dreamfactory/4355 "2018-03-30T17:42:04Z")

</div>

Hello, Does anybody recommend to use dreamfactory for new project? Currently I am using PARSE Server, but found dreamfactory an interesting alternative. But what makes me reluctant is that the Code Exampe for swift is o…

---

## [Power Query (M) pulling multiple pages](https://community.dreamfactory.com/t/power-query-m-pulling-multiple-pages/3747)

<div class="topic-metadata">

**Author:** [@jraiche](https://community.dreamfactory.com/u/jraiche)\
**Replies:** 3\
**Last updated:** [December 26, 2017, 5:29pm UTC](https://community.dreamfactory.com/t/power-query-m-pulling-multiple-pages/3747 "2017-12-26T17:29:05Z")

</div>

This PowerQuery/M code automatically grabs multiple pages of dreamfactory JSON recursively. The column will still need to be expanded, etc, as usual. Improvements welcome, I'm by no means a powerquery expert, but I wa…

---

## [Angular2-CLI Quickstart for Authentication](https://community.dreamfactory.com/t/angular2-cli-quickstart-for-authentication/3891)

<div class="topic-metadata">

**Author:** [@Hardcoded](https://community.dreamfactory.com/u/Hardcoded)\
**Replies:** 1\
**Last updated:** [July 27, 2017, 9:43pm UTC](https://community.dreamfactory.com/t/angular2-cli-quickstart-for-authentication/3891 "2017-07-27T21:43:03Z")

</div>

I have a quickstart that I am working on. It will get you through basic authentication. I will be adding more as I go along.

---

## [Contacts Addressbook Example not retrieving relations](https://community.dreamfactory.com/t/contacts-addressbook-example-not-retrieving-relations/3954)

<div class="topic-metadata">

**Author:** [@chris8374](https://community.dreamfactory.com/u/chris8374)\
**Replies:** 0\
**Last updated:** [July 19, 2017, 6:50pm UTC](https://community.dreamfactory.com/t/contacts-addressbook-example-not-retrieving-relations/3954 "2017-07-19T18:50:08Z")

</div>

Hello, I have a big problem with the current address book example on df 2.7.0.1. The app is running fine, but I can’t retrieve the relations from a contact to contact info etc. When I do the GET /api/v2/db/\_table/contac…

---

## [Connect with PHP 7 to MSSQL Server using pdo\_dblib](https://community.dreamfactory.com/t/connect-with-php-7-to-mssql-server-using-pdo-dblib/3787)

<div class="topic-metadata">

**Author:** [@mailinger](https://community.dreamfactory.com/u/mailinger)\
**Replies:** 0\
**Last updated:** [April 20, 2017, 3:44pm UTC](https://community.dreamfactory.com/t/connect-with-php-7-to-mssql-server-using-pdo-dblib/3787 "2017-04-20T15:44:42Z")

</div>

Hello all, I am coding a service in PHP and try to connect to a MSSQL database with pdo\_dblib and always get the same error message: SQLSTATE\[01002\] Adaptive Server connection failed (severity 9) Here is the script …

---

## [Container dropdown in file services not found](https://community.dreamfactory.com/t/container-dropdown-in-file-services-not-found/3512)

<div class="topic-metadata">

**Author:** [@bhuvana.abhisheg](https://community.dreamfactory.com/u/bhuvana.abhisheg)\
**Replies:** 1\
**Last updated:** [December 22, 2016, 4:56pm UTC](https://community.dreamfactory.com/t/container-dropdown-in-file-services-not-found/3512 "2016-12-22T16:56:12Z")

</div>

Hi.. I am trying to setup the sample application for AngularJS in dreamfactory. In services --\> file services --\> config , the relevant container dropdown is missing. So I am not able to host my application in server. …

---

## [Assigning an existing default 'registerd' role for a new application](https://community.dreamfactory.com/t/assigning-an-existing-default-registerd-role-for-a-new-application/3526)

<div class="topic-metadata">

**Author:** [@Vsevolod\_Gromov](https://community.dreamfactory.com/u/Vsevolod_Gromov)\
**Replies:** 0\
**Last updated:** [December 20, 2016, 9:33am UTC](https://community.dreamfactory.com/t/assigning-an-existing-default-registerd-role-for-a-new-application/3526 "2016-12-20T09:33:44Z")

</div>

PHP script to assign specific default role for a new application to each existing user See a PHP snippet

---

## [A Syncfusion custom data adapter](https://community.dreamfactory.com/t/a-syncfusion-custom-data-adapter/3515)

<div class="topic-metadata">

**Author:** [@delebash](https://community.dreamfactory.com/u/delebash)\
**Replies:** 0\
**Last updated:** [December 18, 2016, 7:27pm UTC](https://community.dreamfactory.com/t/a-syncfusion-custom-data-adapter/3515 "2016-12-18T19:27:12Z")

</div>

I have made a custom data adapter for use with Syncfusion's javascript product. It's an initial commit and is not ready for production, but most features are working. Clone from github Also just a note: Syncfusion o…

---

## [I am umable to solve the problem at console](https://community.dreamfactory.com/t/i-am-umable-to-solve-the-problem-at-console/3318)

<div class="topic-metadata">

**Author:** [@ashwin](https://community.dreamfactory.com/u/ashwin)\
**Replies:** 2\
**Last updated:** [October 12, 2016, 8:15am UTC](https://community.dreamfactory.com/t/i-am-umable-to-solve-the-problem-at-console/3318 "2016-10-12T08:15:42Z")

</div>

Hi I am new to dream factory and facing the issue after importing angular js application Any one Please check http://prntscr.com/cs2rnn . Thanks in advance to help

---

## [JavaScript Addressbook modifiction: fine locally but error on ec2](https://community.dreamfactory.com/t/javascript-addressbook-modifiction-fine-locally-but-error-on-ec2/2471)

<div class="topic-metadata">

**Author:** [@thallstein](https://community.dreamfactory.com/u/thallstein)\
**Replies:** 2\
**Last updated:** [April 4, 2016, 6:07pm UTC](https://community.dreamfactory.com/t/javascript-addressbook-modifiction-fine-locally-but-error-on-ec2/2471 "2016-04-04T18:07:06Z")

</div>

I added a few minor modifications to test out functionality & the changes work locally but not on the server. When run locally I click my testing button to execute a block of code and it executes and returns table data. …

---

## [Email template html](https://community.dreamfactory.com/t/email-template-html/790)

<div class="topic-metadata">

**Author:** [@selfeky](https://community.dreamfactory.com/u/selfeky)\
**Replies:** 5\
**Last updated:** [February 12, 2016, 1:21pm UTC](https://community.dreamfactory.com/t/email-template-html/790 "2016-02-12T13:21:44Z")

</div>

How can create an email template or change the default email template html wise? not just content Thanks

---

## [User Login with Swift](https://community.dreamfactory.com/t/user-login-with-swift/1695)

<div class="topic-metadata">

**Author:** [@Gavin\_Beard](https://community.dreamfactory.com/u/Gavin_Beard)\
**Replies:** 1\
**Last updated:** [November 3, 2015, 7:11pm UTC](https://community.dreamfactory.com/t/user-login-with-swift/1695 "2015-11-03T19:11:02Z")

</div>

Hi all, Apologies if I have missed this, but I've done a quick search and couldn't find a solid example. Has anyone managed to write anything to log into Dreamfactory (or even better, user registration) that uses Swif…

---

## [REST API Architecture (.net service wrapper)](https://community.dreamfactory.com/t/rest-api-architecture-net-service-wrapper/1516)

<div class="topic-metadata">

**Author:** [@Abhishek\_Tiwari](https://community.dreamfactory.com/u/Abhishek_Tiwari)\
**Replies:** 5\
**Last updated:** [October 1, 2015, 4:18am UTC](https://community.dreamfactory.com/t/rest-api-architecture-net-service-wrapper/1516 "2015-10-01T04:18:08Z")

</div>

Client wants us to do the following points Basically the architecture is that: 1 DreamFactory as the data access layer to the database 2. We’ll have a .net service wrapper that handles authentication, token assignme…

---

## [How to add "AddItem" in AngularJS](https://community.dreamfactory.com/t/how-to-add-additem-in-angularjs/1445)

<div class="topic-metadata">

**Author:** [@khargy](https://community.dreamfactory.com/u/khargy)\
**Replies:** 0\
**Last updated:** [September 5, 2015, 10:09pm UTC](https://community.dreamfactory.com/t/how-to-add-additem-in-angularjs/1445 "2015-09-05T22:09:35Z")

</div>

I'm new to both DreamFactory and AngularJS, so please bear with me. \[smile\] I'm trying to modify the todoangular example to work with my data. I updated the get function successfully and my data is bound on the front…

---

## [Has anyone used Dreamfactory with Kendo UI](https://community.dreamfactory.com/t/has-anyone-used-dreamfactory-with-kendo-ui/1430)

<div class="topic-metadata">

**Author:** [@Fabien\_Calais](https://community.dreamfactory.com/u/Fabien_Calais)\
**Replies:** 2\
**Last updated:** [September 4, 2015, 2:34pm UTC](https://community.dreamfactory.com/t/has-anyone-used-dreamfactory-with-kendo-ui/1430 "2015-09-04T14:34:05Z")

</div>

The idea is to replace an old Reporting Solution by Dreamfactory + Kendo UI

---

## [Howto: iOS Grand Central Dispatch + Swift login and persist](https://community.dreamfactory.com/t/howto-ios-grand-central-dispatch-swift-login-and-persist/1392)

<div class="topic-metadata">

**Author:** [@ekh](https://community.dreamfactory.com/u/ekh)\
**Replies:** 1\
**Last updated:** [August 19, 2015, 3:52pm UTC](https://community.dreamfactory.com/t/howto-ios-grand-central-dispatch-swift-login-and-persist/1392 "2015-08-19T15:52:40Z")

</div>

Just in case this helps someone out there: here's some code of mine that uses Apple's grand central dispatch to login to DF but wait on the completion of the block before attempting to persist with the session\_id. More e…

---

## [Sync Contacts from Mssql](https://community.dreamfactory.com/t/sync-contacts-from-mssql/618)

<div class="topic-metadata">

**Author:** [@JaY0](https://community.dreamfactory.com/u/JaY0)\
**Replies:** 1\
**Last updated:** [August 14, 2015, 3:36pm UTC](https://community.dreamfactory.com/t/sync-contacts-from-mssql/618 "2015-08-14T15:36:41Z")

</div>

I have a Microsoft MSSQL databse setup in dreamfactory. I would like to sync contacts to the mssql database from Vtiger crm which has webservices. Has anyone done anything like?

---

## [Access angular controller function from dreamfactory directive](https://community.dreamfactory.com/t/access-angular-controller-function-from-dreamfactory-directive/872)

<div class="topic-metadata">

**Author:** [@markaduffy](https://community.dreamfactory.com/u/markaduffy)\
**Replies:** 0\
**Last updated:** [February 20, 2015, 3:46pm UTC](https://community.dreamfactory.com/t/access-angular-controller-function-from-dreamfactory-directive/872 "2015-02-20T15:46:26Z")

</div>

I thought I would ask here, incase there is dreamfactory solution. im trying to call a parent controller function from inside .directive('dreamfactoryUserLogin' .controller('LoginCtrl', \['$scope', '$location', '$stat…

---

## [Javascript form to POST data to back end database?](https://community.dreamfactory.com/t/javascript-form-to-post-data-to-back-end-database/842)

<div class="topic-metadata">

**Author:** [@robert1on1](https://community.dreamfactory.com/u/robert1on1)\
**Replies:** 1\
**Last updated:** [February 14, 2015, 1:51pm UTC](https://community.dreamfactory.com/t/javascript-form-to-post-data-to-back-end-database/842 "2015-02-14T13:51:50Z")

</div>

Hello, I\`m new to dreamfactory and i have what i believe to be a basic question that i need help with? I would like to create a form to through which a user can send data to the backend database, This is part of some sa…

---

## [Example Angular App That hits Remote MySQL](https://community.dreamfactory.com/t/example-angular-app-that-hits-remote-mysql/506)

<div class="topic-metadata">

**Author:** [@benjaminmbrown](https://community.dreamfactory.com/u/benjaminmbrown)\
**Replies:** 3\
**Last updated:** [October 30, 2014, 9:25pm UTC](https://community.dreamfactory.com/t/example-angular-app-that-hits-remote-mysql/506 "2014-10-30T21:25:57Z")

</div>

Are there any example apps based on this https://github.com/dreamfactorysoftware/angular-dreamfactory. I'm looking for an app, not code snippets. I'm having trouble getting everything working and having a working app to …

---

## [Has anyone used Dreamfactory with React (from facebook)](https://community.dreamfactory.com/t/has-anyone-used-dreamfactory-with-react-from-facebook/468)

<div class="topic-metadata">

**Author:** [@alindzon](https://community.dreamfactory.com/u/alindzon)\
**Replies:** 4\
**Last updated:** [October 17, 2014, 1:43pm UTC](https://community.dreamfactory.com/t/has-anyone-used-dreamfactory-with-react-from-facebook/468 "2014-10-17T13:43:51Z")

</div>

I am currently experimenting with angularjs, and I read some information that makes React sound intriguing as an alternative platform for app development.

---

## [.Net Example of connecting and consuming the API](https://community.dreamfactory.com/t/net-example-of-connecting-and-consuming-the-api/430)

<div class="topic-metadata">

**Author:** [@mark\_c\_vandermolen](https://community.dreamfactory.com/u/mark_c_vandermolen)\
**Replies:** 1\
**Last updated:** [October 6, 2014, 8:35pm UTC](https://community.dreamfactory.com/t/net-example-of-connecting-and-consuming-the-api/430 "2014-10-06T20:35:25Z")

</div>

Can someone provide an example of .Net code that authenticates, authorizes and consumes the Dreamfactory API?

---

## [Simple example of calling DreamFactory with Angular's $resource](https://community.dreamfactory.com/t/simple-example-of-calling-dreamfactory-with-angulars-resource/130)

<div class="topic-metadata">

**Author:** [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Replies:** 0\
**Last updated:** [July 2, 2014, 9:54pm UTC](https://community.dreamfactory.com/t/simple-example-of-calling-dreamfactory-with-angulars-resource/130 "2014-07-02T21:54:00Z")

</div>

Angular's $resource is a simple construct for calling any REST API. Here are a few simple examples of using $resource with DreamFactory. Let's say we create a table 'foo' in DreamFactory (or an external SQL or NoSQL d…

---

## [Let's have some fun with AJAX!](https://community.dreamfactory.com/t/lets-have-some-fun-with-ajax/70)

<div class="topic-metadata">

**Author:** [@Mark](https://community.dreamfactory.com/u/Mark)\
**Replies:** 0\
**Last updated:** [May 28, 2014, 7:01pm UTC](https://community.dreamfactory.com/t/lets-have-some-fun-with-ajax/70 "2014-05-28T19:01:53Z")

</div>

// SAMPLE AJAX FUNCTION // $table\_name - required - name of table to be queried // $id - optional - id of individual record to be returned // $params - optional - request parameters that will be formatted for url func…

---

## [Where are code tutorials and "how to's"?](https://community.dreamfactory.com/t/where-are-code-tutorials-and-how-tos/57)

<div class="topic-metadata">

**Author:** [@benbusse](https://community.dreamfactory.com/u/benbusse)\
**Replies:** 0\
**Last updated:** [May 14, 2014, 9:07pm UTC](https://community.dreamfactory.com/t/where-are-code-tutorials-and-how-tos/57 "2014-05-14T21:07:32Z")

</div>

We've compiled a list of blog tutorials on the Wiki. Also take a look at the screencasts we've done to help get you started. If you have ideas for helpful tutorials and screencasts, or if you want to create your own…
