Lokad API version 2
Important
This page is not intended to be an introduction to web-services technologies but a technical reference documentation. For an introduction, please refer to SOAP article on Wikipedia. For the API documentation and tutorials, you can check the Lokad API product page.
Development
.NET development
.NET developers do not have to use this service endpoint directly. There is a Lokad .NET Software Development Kit that provides .NET-friendly wrappers for the API methods along with reliability and request validation logics. All paging and request slicing is performed by Lokad SDK libraries automatically.
Cross-platform development
Additional information on the cross-platform development with this API could be found on the Lokad API Product Page.
Lokad APIv2 Request Limitations and Validation Rules
Request Limitatitions
In order to improve overall experience of all customers, Lokad APIv2 places a certain size limitations on the amount data that could be processed with a single request. You could find specific values below.
Developers leveraging Lokad SDK for .NET do not have to worry about these limits, as they are taken care of internally.
API Limit: AddSeries = 1000
Series per request in ILokadApi.AddSeries(Identity,SerieInfo[])
API Limit: AddTasks = 5000
Tasks per request in ILokadApi.AddTasks(Identity,TaskInfo[])
API Limit: DeleteSeries = 1000
Series per request in ILokadApi.DeleteSeries(Identity,Guid[])
API Limit: DeleteTasks = 2000
Tasks per request in ILokadApi.DeleteTasks(Identity,Guid[])
API Limit: GetEvents_Series = 1000
Series per request in ILokadApi.GetEvents(Identity,Guid[])
API Limit: GetForecasts = 50
Forecasts per request in ILokadApi.GetForecasts(Identity,Guid[])
API Limit: GetSegments_Series = 1000
Segments per request in ILokadApi.GetSerieSegments(Identity,Guid[],SegmentCursor,Int32)
API Limit: GetSeries_Page = within 100 and 1000
Allowed page size in ILokadApi.GetSeries(Identity,Guid,Int32)
API Limit: GetSeriesByPrefix_Page = within 100 and 750
Limit for the page size in ILokadApi.GetSeriesByPrefix(Identity,String,Guid,Int32)
API Limit: GetSerieSegments_Page = within 250 and 25000
Allowed page size in ILokadApi.GetSerieSegments(Identity,Guid[],SegmentCursor,Int32)
API Limit: GetTags_Series = 1000
Series per request in ILokadApi.GetTags(Identity,Guid[])
API Limit: GetTasks_Page = within 100 and 1000
Allowed page size in ILokadApi.GetTasks(Identity,Guid,Int32)
API Limit: GetTasks_Series = 1000
Tasks per request in ILokadApi.GetTasksBySerieIDs(Identity,Guid[])
API Limit: SetEvents_EventsPerRequest = 2500
Events per request in ILokadApi.SetEvents(Identity,EventsForSerie[])
API Limit: SetEvents_Series = 1000
Series per request in ILokadApi.SetEvents(Identity,EventsForSerie[])
API Limit: SetTags_Series = 1000
Series per request in ILokadApi.SetTags(Identity,TagsForSerie[])
API Limit: SetTags_TagsPerRequest = 7000
Tags per request in ILokadApi.SetTags(Identity,TagsForSerie[])
API Limit: UpdateSerieSegments_Segments = 1000
Segments per request in ILokadApi.UpdateSerieSegments(Identity,SegmentForSerie[])
API Limit: UpdateSerieSegments_Values = 100000
Values per request in ILokadApi.UpdateSerieSegments(Identity,SegmentForSerie[])
API Limit: UpdateTasks = 2000
Tasks per request in ILokadApi.UpdateTasks(Identity,TaskInfo[])
Validation Rules
Lokad APIv2 enforces a certain set of business and validation rules upon all data sent into the system. You can find these rules below.
API Rule: Endpoint
Endpoint should be hosted on Lokad servers and represent a valid connection string.
API Rule: Event
SerieEvent.Name should have length within 1 and 32 characters and comply with the ApiRules.ValidName. SerieEvent.Time should pass ApiRules.ValidDate rule. SerieEvent.DurationDays should be a non-negative valid double that is smaller than 10^6. SerieEvent.KnownSince should either be empty or pass ApiRules.ValidDate rule.
API Rule: Events
EventsForSerie.SerieID should be set to a valid value, while every item in the array should comply with the ApiRules.Event rule.
API Rule: Identity
Idenity should have Username according to the ApiRules.UserName rule and password that is valid within the ApiRules.Passwordrule.
API Rule: IllegalCharacters
Characters that are invalid in the names of tags, events, series etc: ;[]<>"'\/#?+
API Rule: NewSerie
New serie should have SerieInfo.SerieID that is not set and SerieInfo.Name that passes ApiRules.SerieName rule.
API Rule: NewTask
New task should have TaskInfo.TaskID that is not set and should comply with the ApiRules.TaskBody rule.
API Rule: Password
Password should have length within 1 and 256 characters
API Rule: Report
Report should have a valid Subject (length within 5 and 256 characters) and a valid Message (length within 2 and 4000 characters)
API Rule: Segment
Segment should have SegmentForSerie.SerieID set to a valid identifier. Each item within SegmentForSerie.Values should pass ApiRules.Value rule.
API Rule: Segments
Segments array should have legth limited by LokadApiRequestLimits.UpdateSerieSegments_Segments while the total value should be less than LokadApiRequestLimits.UpdateSerieSegments_Values. Each segment should comply with the ApiRules.Segment rule and have SerieId that is unique within this call.
API Rule: SerieName
Name of a serie must comply with ApiRules.ValidName rule and have lentgth within 1 and 64 characters.
API Rule: SetEvents
While setting the events, number of items in the array should be less than LokadApiRequestLimits.SetEvents_Series, while the total number of events should be less than LokadApiRequestLimits.SetEvents_EventsPerRequest. Each array item should comply with the ApiRules.SetEvents rule.
API Rule: SetTags
While setting tags, array of TagsForSerie should have length limited by LokadApiRequestLimits.SetTags_Series, while the totak number of tags should be less than LokadApiRequestLimits.SetTags_TagsPerRequest. Every item in the array should be valid according to the ApiRules.Tags rule.
API Rule: Tags
TagsForSerie.SerieID should be set to a valid value, while every tag in the array should comply with the ApiRules.ValidTag rule.
API Rule: Task
Existing task should have TaskInfo.TaskID that is set to a valid value and should comply with the ApiRules.TaskBody rule.
API Rule: TaskBody
Task should have TaskInfo.Period and TaskInfo.SerieID with set values. TaskInfo.PeriodStart must pass ApiRules.ValidDate. TaskInfo.FuturePeriods should be within a valid range as defined by ApiRules.ValidateFuturePeriods.
API Rule: UserName
User name should have length within 6 and 256 characters and should be a valid email.
API Rule: ValidateFuturePeriods
TaskInfo.FuturePeriods should be greater than 0 and less than 64 for all periods, with the following exceptions: Period.QuarterHour - 6*7*24, Period.HalfHour - 6*7*24*2, Period.Hour - 6*7*24.
API Rule: ValidConnection
Each connection should have ServiceConnection.Username passing the ApiRules.UserName rule, while ServiceConnection.Password passes the ApiRules.Password rule and an ServiceConnection.Endpoint is valid according to the ApiRules.Endpoint rule.
API Rule: ValidDate
All dates should represent a valid MS SQL date. They must be represented in culture invariant format and be greater than 1753-01-01.
API Rule: ValidName
Name can't have IllegalCharacters and must be valid for XMLSerialization.
API Rule: ValidTag
Name of the tag must be comply with ApiRules.ValidName and should have length within 1 and 32 characters.
API Rule: Value
TimeValue.Value should represent a valid double, while TimeValue.Time should pass the ApiRules.ValidDate rule.
Lokad APIv2 Methods
The following operations are supported. For a formal definition, please review the Service Description.
-
AddReport
Creates new report in the Lokad API.
See M:Lokad.Api.ISystemApi.AddReport in the Technical Documentation for more details.
Parameters:
- identity - The identity of the reporter.
- report - The report itself.
Returns: Unique identifier for the newly created report, that could be used as a reference later.
-
AddSeries
Adds new series to the current Lokad account.
See M:Lokad.Api.ITimeSerieApi.AddSeries in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents account to work with.
- series - The series to be added (max 1000 per request). These series must have empty unique identifiers.
Returns: new unique identifiers for the added series
-
AddTasks
Creates multiple tasks for the specified Lokad Account, associating them to the specified series. A serie can have only one task, exception will be thrown if this constraint is violated.
See M:Lokad.Api.IForecastApi.AddTasks in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- tasks - The tasks to create. These tasks must have empty task identifiers and populated serie identifiers (max 5000 tasks per request).
Returns: Array of unique identifiers for the created tasks
-
DeleteSeries
Deletes the specified series from the current Lokad account.
See M:Lokad.Api.ITimeSerieApi.DeleteSeries in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- serieIDs - IDs of the series to be deleted (max 1000 per request).
-
DeleteTasks
Deletes the specified tasks from the Lokad account.
See M:Lokad.Api.IForecastApi.DeleteTasks in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the Lokad account to work with.
- taskIDs - IDs of the tasks to delete (max 2000 tasks per request).
-
GetAccountInfo
Gets the account info for the provided identity. Exception is thrown if the credentials are invalid
See M:Lokad.Api.IAccountApi.GetAccountInfo in the Technical Documentation for more details.
Parameters:
- identity - The identity.
Returns: account information for the provided identity
-
GetEvents
Retrieves events for the specified series
See M:Lokad.Api.ITimeSerieApi.GetEvents in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- serieIDs - Unique identifiers for series to retrieve events for (max 1000 series per request).
-
GetForecasts
Retrieves the forecasts associated with the specified tasks.
See M:Lokad.Api.IForecastApi.GetForecasts in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- taskIDs - Unique identifiers for the tasks (max 50 per request).
Returns: array of the objects
-
GetSerieSegments
Gets the value segments for the specified series. Deprecated in APIv3.
See M:Lokad.Api.ITimeSerieApi.GetSerieSegments in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- serieIDs - Unique identifiers for the series (max 1000 per request)
- cursor - The cursor (use the empty cursor for the first page and for all subsequent calls).
- pageSize - Size of the page (within 250 and 25000).
Returns: page with the values
-
GetSeries
Allows to page through SerieInfo collection associated with the current account. See M:Lokad.Api.ITimeSerieApi.GetSeries in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents account to work with.
- cursor - The cursor (use for the first page and then for the pages afterwards).
- pageSize - Size of the page (between 100 and 1000).
Returns: page with the series
-
GetSeriesByPrefix
Deprecated and will no longer be supported in APIv3! Allows to page through SerieInfo collection associated with the specified prefix and current account.
See M:Lokad.Api.ILegacyApi.GetSeriesByPrefix in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents account to work with.
- prefix - The prefix to look for.
- cursor - The cursor (use for the first page and then for the pages afterwards).
- pageSize - Size of the page (between 100 and 750).
Returns: page with the series
-
GetTags
Retrieves tags for the specified series
See M:Lokad.Api.ITimeSerieApi.GetTags in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- serieIDs - Unique identifiers for series to retrieve tags for (max 1000 series per request)
Returns: tags for the series.
-
GetTasks
Allows to page through the TaskInfo collections associated with the Lokad account
See M:Lokad.Api.IForecastApi.GetTasks in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents Lokad account to work with.
- cursor - The cursor for paging (use for the first page and for all subsequent pages).
- pageSize - Size of the page.
Returns: page that contains objects for the specified account (within 100 and 1000).
-
GetTasksBySerieIDs
Retrieve tasks based on the provided serieIDs
See M:Lokad.Api.IForecastApi.GetTasksBySerieIDs in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- serieIDs - The serie IDs (max 1000 series per request).
Returns: Tasks that were found in the system
-
SetEvents
Sets the events for the specified series. Old events get completely overwritten, if present.
See M:Lokad.Api.ITimeSerieApi.SetEvents in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- eventsForSerie - The events for serie (max 1000 series and 2500 events).
-
SetPartner
Sets the partner for a given identity.
See M:Lokad.Api.IAccountApi.SetPartner in the Technical Documentation for more details.
Parameters:
- identity - The identity.
- partnerId - of a partner or 0 to reset.
-
SetTags
Sets the tags for the specified series, completely overwriting the old tags, if present.
See M:Lokad.Api.ITimeSerieApi.SetTags in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- tagsForSerie - The tags for serie (max 1000 series and 7000 tags total per request).
-
UpdateSerieSegments
Allows to update series with the values. Inclusive segment defined by the SegmentForSerie gets overwritten by the provided one. Duplicate SerieIds are not allowed within a method call.
See M:Lokad.Api.ITimeSerieApi.UpdateSerieSegments in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the account to work with.
- segments - The segments to be uploaded (max 1000 segments of 25000 values total per request).
-
UpdateTasks
Updates the tasks.
See M:Lokad.Api.IForecastApi.UpdateTasks in the Technical Documentation for more details.
Parameters:
- identity - The identity that represents the Lokad account to work with.
- tasks - The tasks (max 2000 tasks per request).