Cochrane+ App API

<back to all web services

Test

The following routes are available for this service:
GET/testSimple test method to confirm the services are working
import 'package:servicestack/servicestack.dart';

class TestResult implements IConvertible
{
    bool? wasSuccessful;
    String? description;

    TestResult({this.wasSuccessful,this.description});
    TestResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        wasSuccessful = json['wasSuccessful'];
        description = json['description'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'wasSuccessful': wasSuccessful,
        'description': description
    };

    getTypeName() => "TestResult";
    TypeContext? context = _ctx;
}

class TestResponse implements IConvertible
{
    String? environment;
    Map<String,TestResult?>? tests;
    bool? wasSuccessful;
    String? db;

    TestResponse({this.environment,this.tests,this.wasSuccessful,this.db});
    TestResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        environment = json['environment'];
        tests = JsonConverters.fromJson(json['tests'],'Map<String,TestResult?>',context!);
        wasSuccessful = json['wasSuccessful'];
        db = json['db'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'environment': environment,
        'tests': JsonConverters.toJson(tests,'Map<String,TestResult?>',context!),
        'wasSuccessful': wasSuccessful,
        'db': db
    };

    getTypeName() => "TestResponse";
    TypeContext? context = _ctx;
}

class Test implements IConvertible
{
    /**
    * An email address a test email will be sent to
    */
    // @ApiMember(Description="An email address a test email will be sent to")
    String? smtp;

    Test({this.smtp});
    Test.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        smtp = json['smtp'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'smtp': smtp
    };

    getTypeName() => "Test";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'cochraneplus_api_dev.happen.zone', types: <String, TypeInfo> {
    'TestResult': TypeInfo(TypeOf.Class, create:() => TestResult()),
    'TestResponse': TypeInfo(TypeOf.Class, create:() => TestResponse()),
    'Map<String,TestResult?>': TypeInfo(TypeOf.Class, create:() => Map<String,TestResult?>()),
    'Test': TypeInfo(TypeOf.Class, create:() => Test()),
});

Dart Test DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /test HTTP/1.1 
Host: cochraneplus-api-dev.happen.zone 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<TestResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WebService.ServiceModel">
  <DB>String</DB>
  <Environment>String</Environment>
  <Tests xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringTestResultQA0sK3Sx>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>
        <Description>String</Description>
        <WasSuccessful>false</WasSuccessful>
      </d2p1:Value>
    </d2p1:KeyValueOfstringTestResultQA0sK3Sx>
  </Tests>
</TestResponse>