POST | /address | Call to list addresses | POST request to search for addresses. Using Postcode and House Name/Number as input. |
---|---|---|---|
GET | /address/{Postcode} | Call to list addresses | GET request to search for addresses. Using Token, Postcode and House Name/Number as input. |
GET | /address/{Postcode}/{HouseNo} | Call to show a specific address | GET request to search for addresses. Using Token, Postcode and House Name/Number as input. |
import 'package:servicestack/servicestack.dart';
/**
* This RESTful API returns UK Address data in both POST and GET. Input=Postcode(Mandatory), HouseNameorNumber=(Optional). You must provide valid authentication to make a request.
*/
// @Api(Description="This RESTful API returns UK Address data in both POST and GET. Input=Postcode(Mandatory), HouseNameorNumber=(Optional). You must provide valid authentication to make a request.")
// @ApiResponse(Description="Bad Request: Try formatting the request differently. See the /swagger-ui/ documentation for more details", StatusCode=400)
// @ApiResponse(Description="Something went wrong here. Please contact your administrator or servicedesk@uk.rapp.com for more details.", StatusCode=500)
// @ApiResponse(Description="Request Accepted", StatusCode=202)
// @ApiResponse(Description="No content returned", StatusCode=204)
class PostcodeLookupRequest implements IConvertible
{
/**
* Using a Postcode to return addresses.
*/
// @ApiMember(DataType="string", Description="Using a Postcode to return addresses.", IsRequired=true, Name="Postcode")
String? Postcode;
/**
* Optional input value to limit the return data to a specific address.
*/
// @ApiMember(DataType="string", Description="Optional input value to limit the return data to a specific address.", Name="House Name or Number")
String? HouseNo;
PostcodeLookupRequest({this.Postcode,this.HouseNo});
PostcodeLookupRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Postcode = json['Postcode'];
HouseNo = json['HouseNo'];
return this;
}
Map<String, dynamic> toJson() => {
'Postcode': Postcode,
'HouseNo': HouseNo
};
getTypeName() => "PostcodeLookupRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'webservices.mbukdatabase.co.uk', types: <String, TypeInfo> {
'PostcodeLookupRequest': TypeInfo(TypeOf.Class, create:() => PostcodeLookupRequest()),
});
Dart PostcodeLookupRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /address HTTP/1.1
Host: webservices.mbukdatabase.co.uk
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<PostcodeLookupRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/PostcodeLookupService.ServiceModel.Types">
<HouseNo>String</HouseNo>
<Postcode>String</Postcode>
</PostcodeLookupRequest>