POST | /scheduling/class-schedule | Create a Class Schedule |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ClubReady.Web.Api.Scheduling.Model;
using ClubReady.Core.Api.Models;
using ClubReady.Web.Api;
namespace ClubReady.Core.Api.Models
{
public partial class ApiDtoBase
{
public virtual string ApiKey { get; set; }
public virtual int? StoreId { get; set; }
public virtual int? ChainId { get; set; }
}
public partial class ApiResponseBase
{
public virtual bool Success { get; set; }
public virtual string Message { get; set; }
}
public partial class CreateClassScheduleRequestDto
: ApiDtoBase
{
public virtual int ClassId { get; set; }
public virtual DateTime ClassDateTime { get; set; }
public virtual int? TrainerId { get; set; }
public virtual string AlternateClassName { get; set; }
}
public partial class CreateClassScheduleResponseDto
: ApiResponseBase
{
public virtual int? ClassScheduleId { get; set; }
}
}
namespace ClubReady.Web.Api
{
public enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
}
namespace ClubReady.Web.Api.Scheduling.Model
{
public partial class CreateClassScheduleRequest
: CreateClassScheduleRequestDto, IRestrictedApiRequest
{
///<summary>
///Api Key - grants access to resources
///</summary>
[ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")]
public virtual string ApiKey { get; set; }
///<summary>
///Store ID
///</summary>
[ApiMember(DataType="integer", Description="Store ID", IsRequired=true, Name="StoreId", ParameterType="query")]
public virtual int? StoreId { get; set; }
///<summary>
///Class ID
///</summary>
[ApiMember(DataType="integer", Description="Class ID", IsRequired=true, Name="ClassId", ParameterType="query")]
public virtual int ClassId { get; set; }
///<summary>
///Date and Time for Class
///</summary>
[ApiMember(DataType="date-time", Description="Date and Time for Class", IsRequired=true, Name="ClassDateTime", ParameterType="query")]
public virtual DateTime ClassDateTime { get; set; }
///<summary>
///Trainer ID
///</summary>
[ApiMember(DataType="integer", Description="Trainer ID", Name="TrainerId", ParameterType="query")]
public virtual int? TrainerId { get; set; }
///<summary>
///Alternate Class Name
///</summary>
[ApiMember(DataType="string", Description="Alternate Class Name", Name="AlternateClassName", ParameterType="query")]
public virtual string AlternateClassName { get; set; }
public virtual int? RestrictedId { get; set; }
public virtual RestrictedResourceType RestrictedResourceType { get; set; }
}
public partial class CreateClassScheduleResponse
: CreateClassScheduleResponseDto
{
public virtual bool Success { get; set; }
public virtual int? ClassScheduleId { get; set; }
public virtual string Message { get; set; }
}
}
C# CreateClassScheduleRequest 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 /scheduling/class-schedule HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateClassScheduleRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Scheduling.Model">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
<ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
<StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
<AlternateClassName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</AlternateClassName>
<ClassDateTime xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</ClassDateTime>
<ClassId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ClassId>
<TrainerId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</TrainerId>
</CreateClassScheduleRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateClassScheduleResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Scheduling.Model"> <Message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Message> <Success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</Success> <ClassScheduleId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ClassScheduleId> </CreateClassScheduleResponse>