Trendsic Platform Service

<back to all web services

ReportRunRequest

Requires Authentication
Requires any of the roles:Agent, Administrator
The following routes are available for this service:
POST,OPTIONS/v1/report/run
import Foundation
import ServiceStack

public class ReportRunRequest : ReportDefinition
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class ReportDefinition : Codable
{
    public var datasetCode:String
    public var dimensions:[String] = []
    public var measures:[ReportMeasure] = []
    public var joins:[String] = []
    public var filters:String
    public var sorts:[ReportSort] = []
    public var limit:Int

    required public init(){}
}

public class ReportMeasure : Codable
{
    public var fieldCode:String
    public var agg:String

    required public init(){}
}

public class ReportSort : Codable
{
    public var fieldCode:String
    public var dir:String

    required public init(){}
}

public class ReportRunResponse : Codable
{
    public var responseStatus:ResponseStatus
    public var result:ReportRunResult

    required public init(){}
}

public class ReportRunResult : Codable
{
    public var columns:[ReportColumnMeta] = []
    public var rows:[[String:String]] = []
    public var rowCount:Int
    public var truncated:Bool
    public var notes:[String] = []

    required public init(){}
}

public class ReportColumnMeta : Codable
{
    public var code:String
    public var name:String
    public var dataType:String
    public var fieldKind:String
    public var agg:String

    required public init(){}
}


Swift ReportRunRequest DTOs

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

HTTP + JSV

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

POST /v1/report/run HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	DatasetCode: String,
	Dimensions: 
	[
		String
	],
	Measures: 
	[
		{
			FieldCode: String,
			Agg: String
		}
	],
	Joins: 
	[
		String
	],
	Filters: String,
	Sorts: 
	[
		{
			FieldCode: String,
			Dir: String
		}
	],
	Limit: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	},
	Result: 
	{
		Columns: 
		[
			{
				Code: String,
				Name: String,
				DataType: String,
				FieldKind: String,
				Agg: String
			}
		],
		Rows: 
		[
			{
				String: {}
			}
		],
		RowCount: 0,
		Truncated: False,
		Notes: 
		[
			String
		]
	}
}