Coder Social home page Coder Social logo

csharp-open311's Introduction

CSharpOpen311-V2

A set of C# classes for working with v.2 of the Open311 API (GeoReport API V2). For documentation on the GeoReport API, see http://wiki.open311.org/GeoReport_v2

This project was created using Mono version 2.4.4 (http://mono-project.com) and MonoDevelop 2.2.1 (http://monodevelop.com/).

Usage:

using System;
using Open311API;
using Open311API.Exception;
using Open311API.Structs;

namespace Sample
{
	/// <summary>
	/// A simple example that uses the Open311API class library.
	/// </summary>
	class Open311Sample
	{
		// The development endpoint for the Baltimore City Open311 API.
		const string ENDPOINT = "http://311test.baltimorecity.gov/open311/v2/";
	
		// The jurisdiction ID for Washington DC.
		const string JURISDICTION_ID = "baltimorecity.gov";
	
		// Sample service request ID.
		const string SERVICE_RQUEST_ID = "4e6cbd2a9dc2f112940000bc";
	
		// App entry point.
		public static void Main (string[] args)
		{
			// Create a new instance of the Open311 object.
			Open311 report = new Open311(ENDPOINT, JURISDICTION_ID);
		
			try 
			{				
				Console.WriteLine(report.GetServiceRequest(ResponseFormat.XML, SERVICE_RQUEST_ID));
			}
			catch (Open311Exception ex) 
			{
				Console.WriteLine("Sorry. An error occured: " + ex.Message);
			}
		
		}
	
	}

}

Output:

<?xml version="1.0" encoding="UTF-8"?>
<service_requests>
  <request>
    <token>4e6cbd2a9dc2f112940000bc</token>
    <status>submitted</status>
    <service_name>Graffiti Removal</service_name>
    <service_code>4e39a3aad3e2c20ed800000c</service_code>
    <requested_datetime>2011-09-11T09:52:43-04:00</requested_datetime>
    <updated_datetime>2011-09-11T09:52:43-04:00</updated_datetime>
    <lat>39.3257703014457</lat>
    <long>-76.5906496206646</long>
    <media_url>http://311test.baltimorecity.gov/attachments/report/4e6cbd2a9dc2f112940000bc/photo/395284434.jpg</media_url>
  </request>
</service_requests>

csharp-open311's People

Contributors

mheadd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

theinein nlincs

csharp-open311's Issues

Downcase format string in methods

For Open311 methods requiring a format string in a spoecific case (i.e., lower case), add logic to downcase format string.

public string GetServiceList(string format) 
{
    string URL = String.Format(_urlTemplate, _baseURL, ResourceNames.Services, format.ToLower(), _jurisdictionID);
    return MakeAPIRequest(URL, MethodType.GET);
} 

This will ensure proper formatting when the ResponseFormat struct is not used.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.