Solar Providers

Share data about solar providers.

Create a New Provider

HTTP POST http://api.opensolar.org/V1/provider

Example JSON passed in via POST

{
    "provider":
    {
	"name":"OpenSolar"
	"summary":"OpenSolar connects solar providers, products and people."
	"ownerEmail":"william@opensolar.org",
	"webpage":"http:\/\/www.opensolar.org",     
	"logo":"http:\/\/www.opensolar.org\/images\/logo.png",
	"about":"OpenSolar stores data about solar installations, products and the providers who installed them.",
	"type":"private",
	"size":"small",
	"offices":
	[
    	    {
		"postalAddress":"500 West 45th Street, New York, NY 10036",
		"geoPt":
		{
		    "lat":40.75,
		    "lon":-74.0
		},
		"telephone":"(212) 555-1212",
		"fax":"(212) 555-1212",
		"serviceArea":"25"
	    },
	    {
		"postalAddress":"22 Plymouth Street, Boston, MA",
		"geoPt":
		{
		    "lat":41.51,
		    "lon":-72.32
		},
		"telephone":"(212) 555-1212",
		"serviceArea":"25"
	    }
	]	
    }
}

Required Fields

The following fields are required at a minimum for this request to be successful:

{
    "provider":
    {
	"name":"OpenSolar",	
	"owner":"http:\/\/api.opensolar.org\/V1\/user\/william",	
	"ownerEmail":"william@opensolar.org"
    }
}

Response

If the request is successful, the API will return the HTTP 201 (Created) status code with a simple JSON result object in the body. The "Location" header will point to the newly created resource:

Location: http://api.opensolar.org/V1/provider/1234

Example

{ "result":"success" }

If there has been an error, the service will return the appropriate HTTP status code - most likely a 400 (Bad Request), 401 (Unauthorized) or 403 (Forbidden) error. See the Developer Authorization page for details on how to submit authenticated API requests.


Update an Existing Provider

HTTP POST http://api.opensolar.org/V1/provider/1234

Where 1234 is the ID of the provider that you are trying to modify.

The method will overwrite any root element that you pass in.

Example

Posting the following piece of JSON to http://api.opensolar.org/V1/provider/1234 would overwrite these five fields for provider 1234.

{
    "provider":
    {
	"webpage":"http:\/\/www.opensolar.org",     
	"logo":"http:\/\/www.opensolar.org\/images\/logo.png",
	"about":"OpenSolar connects solar businesses, people and products together.",
	"type":"private",
	"size":"small"
    }
}

Response

If the request is successful, the API will return a HTTP 200 (OK) status code.

Example

{ "result":"success" }