POST | /rockstars |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
import 'dart:collection';
class Rockstar implements IConvertible
{
int? id;
String? firstName;
String? lastName;
int? age;
Rockstar({this.id,this.firstName,this.lastName,this.age});
Rockstar.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
firstName = json['firstName'];
lastName = json['lastName'];
age = json['age'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'firstName': firstName,
'lastName': lastName,
'age': age
};
getTypeName() => "Rockstar";
TypeContext? context = _ctx;
}
class StoreRockstars extends ListBase<Rockstar> implements IConvertible
{
final List<Rockstar> l = [];
set length(int newLength) { l.length = newLength; }
int get length => l.length;
Rockstar operator [](int index) => l[index];
void operator []=(int index, Rockstar value) { l[index] = value; }
StoreRockstars();
StoreRockstars.fromJson(Map<String, dynamic> json) : super();
fromMap(Map<String, dynamic> json) {
return this;
}
Map<String, dynamic> toJson() => {};
getTypeName() => "StoreRockstars";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'test.servicestack.net', types: <String, TypeInfo> {
'Rockstar': TypeInfo(TypeOf.Class, create:() => Rockstar()),
'StoreRockstars': TypeInfo(TypeOf.Class, create:() => StoreRockstars()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /rockstars HTTP/1.1
Host: test.servicestack.net
Accept: application/json
Content-Type: application/json
Content-Length: length
[]
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length []