API Documentation


Overview


The web service will respond with JSON. You can call methods on the web service using HTTP requests.

Service endpoints URLs will follow this general format:
http://cms.goodnews-trueliving.com/API/ + Object + / + Action

If a method requires parameters, they should be appended to the query string or included in the body of the request.

Status Codes
Code Value
-1 Unhandled Exception
0 Success
1 User Name Exists
2 Login Failed

Community Poll


API calls for data related to the "Community Vote and Poll" section of the mobile application.

GetCommunityPolls

Gets all community vote and polls. Returned as a list of surveys.

Example query: GET http://cms.goodnews-trueliving.com/API/CommunityPoll/

Example response:

{
   "Surveys":[
      {
         "Id":18,
         "MaxScore":0,
         "Name":"Summer 2013 Seminar Poll",
         "SurveyType":2,
         "Questions":[
            {
               "Id":11,
               "QuestionText":"What do you think is the primary health concern facing the Fort Worth community at this time?",
               "SurveyId":18,
               "Responses":[
                  {
                     "Id":13,
                     "ResponseText":"Obesity",
                     "PointValue":0,
                     "QuestionId":11
                  },
                  {
                     "Id":14,
                     "ResponseText":"Diabetes",
                     "PointValue":0,
                     "QuestionId":11
                  },
                  {
                     "Id":15,
                     "ResponseText":"Cancer",
                     "PointValue":0,
                     "QuestionId":11
                  }
               ]
            },
            {
               "Id":12,
               "QuestionText":"New Question",
               "SurveyId":18,
               "Responses":[

               ]
            }
         ]
      }
   ],
   "Status":0
}
						


Education Resources


API calls for data related to the "Education Resources" section of the mobile application.

GetList

Get a list of all Health Education Resources grouped by category. Resources will include an id, title, and URL for the resource.

Example query: GET http://cms.goodnews-trueliving.com/API/HEResource/List

Example response:

{
    Categories: [
        {
            Id: 23,
            Name: "Environmental Resource",
            Resources: [
                {
                    Id: 42,
                    Title: "Getting to know about recycling and waste reduction",
                    Link: "http://www.epa.gov/greenhomes/ReduceWaste.htm"
                },
                {
                    Id: 41,
                    Title: "Getting to know more about climate and health",
                    Link: "http://www.cdc.gov/climateandhealth/"
                }
            ]
        },
        {
            Id: 12,
            Name: "Intellectual Resource",
            Resources: [
                {
                Id: 13,
                Title: "Culture in Dallas",
                Link: "http://dallasculture.org/index.asp"
                },
                {
                    Id: 20,
                    Title: "DFW Counseling",
                    Link: "http://therapists.psychologytoday.com/rms/state/TX/Fort+Worth.html"
                },
                {
                    Id: 14,
                    Title: "Free things to do in Dallas",
                    Link: "http://www.visitdallas.com/things-to-do/free-things-to-do/"
                },
                {
                    Id: 15,
                    Title: "Games and Puzzles",
                    Link: "http://games.washingtonpost.com/"
                },
                {
                    Id: 12,
                    Title: "Importance of Intellectual Health",
                    Link: "http://www.healthandwellnessforfamilies.com/health-wellness/intellectual-health/"
                },
                {
                    Id: 16,
                    Title: "USA Today's Puzzles",
                    Link: "http://puzzles.usatoday.com/"
                }
            ]
        },
        {
            Id: 13,
            Name: "Mental Resource",
            Resources: [
                {
                    Id: 19,
                    Title: "How to forgive",
                    Link: "http://health.usnews.com/health-news/articles/2012/08/29/how-to-forgive-and-why-you-should"
                },
                {
                    Id: 18,
                    Title: "Relax after a hard day",
                    Link: "http://www.mdjunction.com/forums/panic-attacks-discussions/general-support/2419058-10-things-i-do-to-relax-after-a-hard-day"
                },
                {
                    Id: 17,
                    Title: "Working with others",
                    Link: "http://www.canterbury.ac.uk/graduate-skills/preview/general/working-with-others/working-with-others-print.pdf"
                }
            ]
        },
        {
            Id: 24,
            Name: "Occupational Resource",
            Resources: [
                {
                    Id: 44,
                    Title: "Creating a Healthy Work Environment",
                    Link: "http://www.cdc.gov/workplacehealthpromotion/index.htm"
                },
                {
                    Id: 45,
                    Title: "Getting to Know Human Resources",
                    Link: "http://www.dol.gov/index.htm"
                },
                {
                    Id: 43,
                    Title: "How to Manage Stress",
                    Link: "http://www.nlm.nih.gov/medlineplus/stress.html"
                },
                {
                    Id: 46,
                    Title: "Professional Development",
                    Link: "http://www.mindtools.com/memory.html"
                }
            ]
        },
        {
            Id: 14,
            Name: "Physical Resource",
            Resources: [
                {
                    Id: 21,
                    Title: "Eat Fruits and Vegetables",
                    Link: "http://www.cdc.gov/nutrition/everyone/fruitsvegetables/index.html"
                },
                {
                    Id: 22,
                    Title: "Fruit & Veggie Budget",
                    Link: "http://www.cdc.gov/nutrition/everyone/fruitsvegetables/index.html"
                },
                {
                    Id: 23,
                    Title: "Fruits & Veggie Information",
                    Link: "http://www.cdc.gov/nutrition/everyone/fruitsvegetables/index.html"
                }
            ]
        },
        {
            Id: 22,
            Name: "Social Resource",
            Resources: [
                {
                    Id: 34,
                    Title: "Enroll in a fitness class",
                    Link: "http://inursha.com/"
                },
                {
                    Id: 35,
                    Title: "Enroll in a yoga class",
                    Link: "http://www.karmanyyoga.com/?gclid=CKHjgJGG4bMCFQiqnQod3xYArA"
                },
                {
                    Id: 32,
                    Title: "Participate in Community Events",
                    Link: "http://www.oecdbetterlifeindex.org/topics/community/"
                },
                {
                    Id: 37,
                    Title: "Resolving Conflicts at Work",
                    Link: "http://positivesharing.com/2006/07/5-essential-steps-to-resolve-a-conflict-at-work/"
                },
                {
                    Id: 39,
                    Title: "Resolving Conflicts with Family",
                    Link: "http://www.focusonthefamily.com/lifechallenges/relationship_challenges/conflict_resolution.aspx"
                },
                {
                    Id: 38,
                    Title: "Resolving Conflicts with Friends",
                    Link: "http://www.livestrong.com/article/184656-how-to-resolve-conflict-with-a-friend/"
                },
                {
                    Id: 36,
                    Title: "The importance of Spending time with family",
                    Link: "http://www.familyfacts.org/briefs/15/a-wise-investment-benefits-from-families-spending-time-together"
                },
                {
                    Id: 33,
                    Title: "Volunteer at a local organization",
                    Link: "http://www.volunteermatch.org/search?l=Fort+Worth%2C+TX%2C+USA"
                },
                {
                    Id: 40,
                    Title: "Working with others",
                    Link: "http://www.canterbury.ac.uk/graduate-skills/preview/general/working-with-others/working-with-others-print.pdf"
                }
            ]
        },
        {
            Id: 25,
            Name: "Spiritual Resource",
            Resources: [
                {
                    Id: 47,
                    Title: "Spiritual ",
                    Link: "http://tour.spiritualresources.org/"
                }
            ]
        }
    ],
    Status: 0
}
						


Fort Worth Resources


API calls for data related to the "Fort Worth Resources" section of the mobile application.

GetList

Get a list of all Fort Worth Resources grouped by category. Only the names and ids are returned with this method. For full information about a resource, use the GetResource method with the id of the resource.

Example query: GET http://cms.goodnews-trueliving.com/API/FWResource/List

Example response:

{
    Categories: [
        {
            Id: 9,
            Name: "Exercise",
            Resources: [
                {
                    Id: 14,
                    Name: "Bike! Fort Worth"
                }
            ]
        },
        {
            Id: 7,
            Name: "Farmer's Markets",
            Resources: [
                {
                    Id: 8,
                    Name: "Farm to Family with Farmer's Market"
                },
                {
                    Id: 7,
                    Name: "Fort Worth Farmer's Market"
                }
            ]
        },
        {
            Id: 6,
            Name: "Healthy Food Supermarkets",
            Resources: [
                {
                    Id: 4,
                    Name: "Central Market"
                },
                {
                    Id: 6,
                    Name: "Cowtown Famer's Market"
                },
                {
                    Id: 5,
                    Name: "Sprout's"
                },
                {
                    Id: 3,
                    Name: "Trader Joe's"
                }
            ]
        },
        {
            Id: 10,
            Name: "Labrynths",
            Resources: [
                {
                    Id: 16,
                    Name: "Cook's Children's Hospital"
                },
                {
                    Id: 2,
                    Name: "St. Stephen's Presbyterian Church"
                },
                {
                    Id: 17,
                    Name: "Unity Church"
                },
                {
                    Id: 15,
                    Name: "University Christian Church"
                }
            ]
        },
        {
            Id: 8,
            Name: "Parks & Community Services",
            Resources: [
                {
                    Id: 11,
                    Name: "Botanic Garden"
                },
                {
                    Id: 13,
                    Name: "Fort Worth Zoo"
                },
                {
                    Id: 9,
                    Name: "Log Cabin Village"
                },
                {
                    Id: 12,
                    Name: "Nature Center & Refuge"
                },
                {
                    Id: 10,
                    Name: "The Herd"
                }
            ]
        }
    ],
    Status: 0
}
						

GetResource

Retrieves full information about a Fort Worth resource. No fields will be null, but some will be empty/blank.

Example query: GET http://cms.goodnews-trueliving.com/API/FWResource/Get/{id}

Example response:

{
    Resource: {
        Id: 2,
        CategoryId: 10,
        Name: "St. Stephen's Presbyterian Church",
        Link: "http://ststephen-pcusa.com/",
        Phone: " ",
        Description: "",
        Street: "2700 McPherson Ave.",
        City: "Fort Worth",
        State: "TX",
        ZipCode: "76109"
    },
    Status: 0
}
						


General


API calls for getting data which doesn't correspond to a particular section of the application. For example, the overview on the main menu, daily quotes, etc.

DailyQuote

Gets the current daily inspirational quote.

Example query: GET http://cms.goodnews-trueliving.com/API/DailyQuote

Example response:

{
	DailyQuote: "We believe every person is not only meant to live, but to live well.",
	Status: 0
}
						

Overview

Get the overview which is to be displayed on the main page of the mobile application.

Example query: GET http://cms.goodnews-trueliving.com/API/Overview

Example response:

{
	OverviewText: "GoodNEWS is a holistic lifestyle enhancement program designed to stimulate healthy thinking and practice in order to prevent the development of disease. GoodNEWS is health care professionals, church pastors and congregations, community organizations and researchers, working together to improve and transform the health and lives of the entire community. Through partnership and collaboration we hope to prevent much of the hypertension, heart disease, diabetes, obesity and other chronic diseases threatening the health and vitality of our communities today.",
	Status: 0
}
						


Health Assessment


API calls for the data related to the "Health Assessment" section of the mobile application.

GetHealthAssessments

Gets all health assessments. Returned as a list of surveys.

Example query: GET http://cms.goodnews-trueliving.com/API/HealthAssessment/

Example response:

{
   "Surveys":[
      {
         "Id":9,
         "MaxScore":0,
         "Name":"Physical Well-Being",
         "SurveyType":0,
         "Questions":[
            {
               "Id":13,
               "QuestionText":"I eat 3 or more servings of fruit and vegetables daily.",
               "SurveyId":9,
               "Responses":[
                  {
                     "Id":16,
                     "ResponseText":"Yes",
                     "PointValue":1,
                     "QuestionId":13
                  },
                  {
                     "Id":17,
                     "ResponseText":"No",
                     "PointValue":0,
                     "QuestionId":13
                  }
               ]
            },
            {
               "Id":14,
               "QuestionText":"I avoid eating foods that are fried, and high in sugar and salt.",
               "SurveyId":9,
               "Responses":[
                  {
                     "Id":18,
                     "ResponseText":"Yes",
                     "PointValue":1,
                     "QuestionId":14
                  },
                  {
                     "Id":19,
                     "ResponseText":"No",
                     "PointValue":0,
                     "QuestionId":14
                  }
               ]
            },
            {
               "Id":15,
               "QuestionText":"Do you get sunlight for 20 minutes every day?",
               "SurveyId":9,
               "Responses":[
                  {
                     "Id":20,
                     "ResponseText":"Never",
                     "PointValue":0,
                     "QuestionId":15
                  },
                  {
                     "Id":21,
                     "ResponseText":"Sometimes",
                     "PointValue":1,
                     "QuestionId":15
                  },
                  {
                     "Id":22,
                     "ResponseText":"Often",
                     "PointValue":2,
                     "QuestionId":15
                  }
               ]
            },
            {
               "Id":16,
               "QuestionText":"Do you drink 8 cups of water per day?",
               "SurveyId":9,
               "Responses":[
                  {
                     "Id":23,
                     "ResponseText":"Never",
                     "PointValue":0,
                     "QuestionId":16
                  },
                  {
                     "Id":24,
                     "ResponseText":"Sometimes",
                     "PointValue":2,
                     "QuestionId":16
                  },
                  {
                     "Id":25,
                     "ResponseText":"Always",
                     "PointValue":4,
                     "QuestionId":16
                  }
               ]
            }
         ]
      },
      {
         "Id":10,
         "MaxScore":0,
         "Name":"Mental Well-Being",
         "SurveyType":0,
         "Questions":[
            {
               "Id":7,
               "QuestionText":"This is just a sample question to test survey management.",
               "SurveyId":10,
               "Responses":[
                  {
                     "Id":6,
                     "ResponseText":"one",
                     "PointValue":0,
                     "QuestionId":7
                  },
                  {
                     "Id":7,
                     "ResponseText":"3",
                     "PointValue":0,
                     "QuestionId":7
                  },
                  {
                     "Id":8,
                     "ResponseText":"2",
                     "PointValue":0,
                     "QuestionId":7
                  },
                  {
                     "Id":9,
                     "ResponseText":"4",
                     "PointValue":0,
                     "QuestionId":7
                  },
                  {
                     "Id":10,
                     "ResponseText":"response 853",
                     "PointValue":123,
                     "QuestionId":7
                  }
               ]
            }
         ]
      },
      {
         "Id":11,
         "MaxScore":0,
         "Name":"Intellectual Well-Being",
         "SurveyType":0,
         "Questions":[

         ]
      },
      {
         "Id":12,
         "MaxScore":0,
         "Name":"Occupational Well-Being",
         "SurveyType":0,
         "Questions":[

         ]
      },
      {
         "Id":13,
         "MaxScore":0,
         "Name":"Spiritual Well-Being",
         "SurveyType":0,
         "Questions":[

         ]
      },
      {
         "Id":14,
         "MaxScore":0,
         "Name":"Social Well-Being",
         "SurveyType":0,
         "Questions":[

         ]
      },
      {
         "Id":15,
         "MaxScore":0,
         "Name":"Environmental Well-Being",
         "SurveyType":0,
         "Questions":[

         ]
      }
   ],
   "Status":0
}
						


Surveying


API calls for data related to surveying.

All surveys will be of a particular type, and this type will be represented with an integer value from the SurveyType enumeration.

SurveyType Enumeration
Integer Value Survey Type
0 Health Assessment
1 Track and Progress
2 Community Vote & Poll
GetUserGrades

Gets the grades for all surveys the user has responded to. Pass the user id into the URL.

Example query: GET http://cms.goodnews-trueliving.com/API/Survey/UserGrades/57

Example response:

{
    UserGrades: [
        {
            SurveyId: 9,
            MostRecent: {
                SurveyId: 9,
                Grade: 0.5,
                TimeTaken: "3/5/2013 5:39:12 PM",
                SurveyType: 0
            },
            AverageGrade: 0.6875,
            TimesTaken: 4
        },
        {
            SurveyId: 10,
            MostRecent: {
                SurveyId: 10,
                Grade: 0,
                TimeTaken: "4/16/2013 2:47:48 PM",
                SurveyType: 0
            },
            AverageGrade: 0.23333333333333334,
            TimesTaken: 30
        }
    ],
    Status: 0
}
						

RespondToSurvey

Stores a user's responses to a survey. Specify the user's id, the time the survey was taken, and the ids of all responses to the survey.

Example query: POST http://cms.goodnews-trueliving.com/API/Survey/Respond

Requst body:

{
	UserId: 57,
	TimeTaken: "3/5/2013 3:08:47 PM",
	ResponseIds: [
		16,
		18,
		21,
		25
	]
}
						

Example response:

{
	"Status": 0
}
						


Track and Progress


API calls for data related to the "Track and Progress" section of the mobile application.

GetTrackAndProgresses

Gets all track and progress surveys. Returned as a list of surveys.

Example query: GET http://cms.goodnews-trueliving.com/API/TrackAndProgress/

Example response:

{
   "Surveys":[
      {
         "Id":17,
         "MaxScore":0,
         "Name":"Daily Survey",
         "SurveyType":1,
         "Questions":[
            {
               "Id":10,
               "QuestionText":"blah  ",
               "SurveyId":17,
               "Responses":[
                  {
                     "Id":11,
                     "ResponseText":"response 1",
                     "PointValue":0,
                     "QuestionId":10
                  },
                  {
                     "Id":12,
                     "ResponseText":"response 2",
                     "PointValue":1,
                     "QuestionId":10
                  }
               ]
            }
         ]
      }
   ],
   "Status":0
}
						


User


API calls for data related to user information and user accounts.

CreateUserAccount

Creates a user account with the supplied information, and returns the user account if it is created. This method can respond with a "Username Exists" status code.

Example query: POST http://cms.goodnews-trueliving.com/API/UserAccount/Create

Requst body:

{
    "Email": "test@test.com",
    "Password": "password",
    "IsAdmin" : 1
}
						

Example response:

{
    "User": {
        "Id": 64,
        "Email": "test@test.com",
        "Password": null,
        "Gender": null,
        "Age": null,
        "EducationLevel": null,
        "IncomeRange": null,
        "EthnicGroup": null,
        "IsAdmin": true,
        "WeightManagementOptIn": true
    },
    "Status": 0
}
						

GetUserAccount

Get user account details based on a user name and password. If login fails, the method will respond with a "Login Failed" status code and the user will be null in the response.

Example query: GET http://cms.goodnews-trueliving.com/API/UserAccount/Get/baer.bradford@goodnews.com?password=password

Example response:

{
	User: {
		Id: 1,
		Email: "baer.bradford@gmail.com",
		Password: null,
		Gender: null,
		Age: null,
		EducationLevel: null,
		IncomeRange: null,
		EthnicGroup: null,
		IsAdmin: true,
		WeightManagementOptIn: true
	},
	Status: 0
}
						

UpdateUserAccount

Updates the user accout information. Must provide Id of existing user account you wish to modify (you can get this using User.GetUserAccount()). Email may not be null, but all attrbiutes may be null. This method does not modify a user's password. Use User.ChangePassword() method for that.

Example query: POST http://cms.goodnews-trueliving.com/API/UserAccount/Edit

Requst body:

{
	Id: 57,
	Email: "baer@goodnews.com",
	Gender: "Male",
	Age: "21",
	EducationLevel: null,
	IncomeRange: "$1,000,000",
	EthnicGroup: "White",
	IsAdmin: true,
	WeightManagementOptIn: true
}
						

Example response:

{
    "Status": 0
}
						

UserAccountExists

Checks to see whether a user name is already being used. A "Username Exists" or "Success" status code will be returned.

Example query: GET http://cms.goodnews-trueliving.com/API/UserAccount/Get/baer.bradford@gmail.com

Example response:

{
	User: null,
	Status: 1
}
						


Weight Management


API calls for data related to the "Weight Management" section of the mobile application.

GetUserWeighIns

Retrieve a user's starting weight and current weight.

Example query: GET http://cms.goodnews-trueliving.com/API/WeightManagement/GetUserWeighIns/57

Example response:

{
    StartWeight: 178,
    CurrentWeight: 191.3,
    Status: 0
}
						

WeighIn

Records a user's weigh in for the Weight Management Program. Supply a user ID and weight (floating point). If a user weighs in multiple times in one day, the most recent weigh in will overwrite previous for the day.

Example query: POST http://cms.goodnews-trueliving.com/API/WeightManagement/WeighIn

Requst body:

{	
  UserId: 57,
  Weight: 190
}
						

Example response:

{
    "Status": 0
}