Reference

Discountcode

The discountcode object

Attributes
Id: int required, autogenerated, unique
The unique identifier for this discountcode
Active: bool optional
BusinessId: Id required
Code: string required
Description: string required
DiscountAmount: decimal? optional
DiscountBookings: bool optional
DiscountEvents: bool optional
DiscountPercentage: decimal? optional
DiscountPricePlans: bool optional
DiscountProducts: bool optional
ExpirationType: Nexudus.Coworking.Core.Enums.eDiscountExpirePeriod? optional
ExpiresIn: int? optional
MaxUses: int? optional
MaxUsesPerUser: int? optional
OnlyForContacts: bool optional
OnlyForMembers: bool optional
PublishFrom: DateTime? optional
PublishTo: DateTime? optional
ReferralDiscount: bool optional
ValidFrom: DateTime? optional
ValidTo: DateTime? optional
UniqueId: Guid required, autogenerated, unique
The globally unique identifier for this discountcode
SystemId: string optional api-only
User defined data about this discountcode. This property can only be seen and updated using the API.

Json Structure Example


{
  "Id": 1234567,
  "Active": false,
  "BusinessId": 12345678,
  "Code": "Code",
  "Description": "Description",
  "DiscountAmount": ,
  "DiscountBookings": false,
  "DiscountEvents": false,
  "DiscountPercentage": ,
  "DiscountPricePlans": false,
  "DiscountProducts": false,
  "ExpirationType": 1,
  "ExpiresIn": ,
  "MaxUses": ,
  "MaxUsesPerUser": ,
  "OnlyForContacts": false,
  "OnlyForMembers": false,
  "PublishFrom": ,
  "PublishTo": ,
  "ReferralDiscount": false,
  "ValidFrom": ,
  "ValidTo": ,
  "UniqueId": "ae3b0e98-f9d2-4a35-a78c-0403ff2fc088",
  "SystemId": "{ metadata: { id: 887766, processed: true } }"
}


Find a DiscountCode

This endpoint allows you to GET a list of discountcodes based on one or more filter querystring parameters.

GET https://spaces.nexudus.com/api/billing/discountcodes?...

πŸ”’ Requires role "DiscountCode-List"

Pagination querystring parameters
Lets control how many records to return at a time and their order.
page integer optional
?page=1
size integer optional default=25
Sets the maximum number of records to return each page of results.
?size=25
orderby string optional default=Code
Sets the property to use when ordering the results of the search.
?orderby=Id
dir 'ascending' or 'descending' optional default=SortDirection.Ascending
Sets the direction to use when ordering the records.
?sort=ascending

Search querystring parameters
Lets you search discountcode records based on their different properties.
Id number
?Id=12345678
DiscountCode_Active bool
?DiscountCode_Active=...
DiscountCode_Business Business
?DiscountCode_Business=...
DiscountCode_Code string
?DiscountCode_Code=...
DiscountCode_Description string
?DiscountCode_Description=...
DiscountCode_DiscountAmount decimal?
?DiscountCode_DiscountAmount=...
DiscountCode_DiscountBookings bool
?DiscountCode_DiscountBookings=...
DiscountCode_DiscountEvents bool
?DiscountCode_DiscountEvents=...
DiscountCode_DiscountPercentage decimal?
?DiscountCode_DiscountPercentage=...
DiscountCode_DiscountPricePlans bool
?DiscountCode_DiscountPricePlans=...
DiscountCode_DiscountProducts bool
?DiscountCode_DiscountProducts=...
DiscountCode_ExpirationType Nexudus.Coworking.Core.Enums.eDiscountExpirePeriod?
?DiscountCode_ExpirationType=...
DiscountCode_ExpiresIn int?
?DiscountCode_ExpiresIn=...
DiscountCode_MaxUses int?
?DiscountCode_MaxUses=...
DiscountCode_MaxUsesPerUser int?
?DiscountCode_MaxUsesPerUser=...
DiscountCode_OnlyForContacts bool
?DiscountCode_OnlyForContacts=...
DiscountCode_OnlyForMembers bool
?DiscountCode_OnlyForMembers=...
DiscountCode_PublishFrom DateTime?
?DiscountCode_PublishFrom=...
DiscountCode_PublishTo DateTime?
?DiscountCode_PublishTo=...
DiscountCode_ReferralDiscount bool
?DiscountCode_ReferralDiscount=...
DiscountCode_ValidFrom DateTime?
?DiscountCode_ValidFrom=...
DiscountCode_ValidTo DateTime?
?DiscountCode_ValidTo=...
DiscountCode_BusinessName string
?DiscountCode_BusinessName=...
DiscountCode_BusinessCurrency_Code string
?DiscountCode_BusinessCurrency_Code=...
DiscountCode_Tariffs List of Tariff
?DiscountCode_Tariffs=...
DiscountCode_ResourceTypes List of ResourceType
?DiscountCode_ResourceTypes=...
DiscountCode_Products List of Product
?DiscountCode_Products=...
DiscountCode_EventCategories List of CalendarEventCategory
?DiscountCode_EventCategories=...

Range search querystring parameters
Lets you search discountcode records based on a range of date or numeric values.
To_DiscountCode_CreatedOn date
?To_DiscountCode_CreatedOn=2010-01-01T20:32
From_DiscountCode_CreatedOn date
?From_DiscountCode_CreatedOn=2010-01-01T20:32
To_DiscountCode_UpdatedOn date
?To_DiscountCode_UpdatedOn=2010-01-01T20:32
From_DiscountCode_UpdatedOn date
?From_DiscountCode_UpdatedOn=2010-01-01T20:32
To_DiscountCode_PublishFrom date
?To_DiscountCode_PublishFrom=2010-01-01T20:32
From_DiscountCode_PublishFrom date
?From_DiscountCode_PublishFrom=2010-01-01T20:32
To_DiscountCode_PublishTo date
?To_DiscountCode_PublishTo=2010-01-01T20:32
From_DiscountCode_PublishTo date
?From_DiscountCode_PublishTo=2010-01-01T20:32
To_DiscountCode_DiscountPercentage number
?To_DiscountCode_DiscountPercentage=0
From_DiscountCode_DiscountPercentage number
?From_DiscountCode_DiscountPercentage=10
To_DiscountCode_DiscountAmount number
?To_DiscountCode_DiscountAmount=0
From_DiscountCode_DiscountAmount number
?From_DiscountCode_DiscountAmount=10
To_DiscountCode_MaxUsesPerUser number
?To_DiscountCode_MaxUsesPerUser=0
From_DiscountCode_MaxUsesPerUser number
?From_DiscountCode_MaxUsesPerUser=10
To_DiscountCode_MaxUses number
?To_DiscountCode_MaxUses=0
From_DiscountCode_MaxUses number
?From_DiscountCode_MaxUses=10
To_DiscountCode_ValidFrom date
?To_DiscountCode_ValidFrom=2010-01-01T20:32
From_DiscountCode_ValidFrom date
?From_DiscountCode_ValidFrom=2010-01-01T20:32
To_DiscountCode_ValidTo date
?To_DiscountCode_ValidTo=2010-01-01T20:32
From_DiscountCode_ValidTo date
?From_DiscountCode_ValidTo=2010-01-01T20:32
To_DiscountCode_ExpiresIn number
?To_DiscountCode_ExpiresIn=0
From_DiscountCode_ExpiresIn number
?From_DiscountCode_ExpiresIn=10

Example request

GET https://spaces.nexudus.com/api/billing/discountcodes?DiscountCode_Code=...
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example response


{
    "Records": [{
        "Id": 1234567,
        "Business": ,
        "Code": "Code",
        "Description": "Description",
        "Active": false,
        "PublishFrom": ,
        "PublishTo": ,
        "DiscountPercentage": ,
        "DiscountAmount": ,
        "ReferralDiscount": false,
        "DiscountPricePlans": false,
        "DiscountBookings": false,
        "DiscountProducts": false,
        "DiscountEvents": false,
        "MaxUsesPerUser": ,
        "MaxUses": ,
        "OnlyForContacts": false,
        "OnlyForMembers": false,
        "ValidFrom": ,
        "ValidTo": ,
        "ExpirationType": 1,
        "ExpiresIn": ,
        "DiscountCodeBusinessName": "...",
        "DiscountCodeBusinessCurrency_Code": "...",
        "CreatedOn": "2018-07-03T06:23:01Z",
        "UpdatedOn": "2020-01-01T21:57:21Z",
        "UpdatedBy": "System",
        "UniqueId": "2af416ab-52ab-46a8-a4df-70dd72ea532f",
        "SystemId": "{ metadata: { id: 887766, processed: true } }"
    }],
    "CurrentPageSize": 25,
    "CurrentPage": 1,
    "CurrentOrderField": "Id",
    "CurrentSortDirection": 1,
    "FirstItem": 1,
    "HasNextPage": true,
    "HasPreviousPage": false,
    "LastItem": 25,
    "PageNumber": 1,
    "PageSize": 25,
    "TotalItems": 60,
    "TotalPages": 3
}


Find DiscountCodes by IDs

Gets one or more discountcode records based on their Id.
GET https://spaces.nexudus.com/api/billing/discountcodes?DiscountCode_Id=[:id1,:id2,...]

πŸ”’ Requires role "DiscountCode-List"

Querystring parameters
DiscountCode_Id: array requried
?DiscountCode_Id=[12345678,87654651]

Example request

GET https://spaces.nexudus.com/api/billing/discountcodes?DiscountCode_Id=[1234567,9876541]
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example response


{
    "Records": [{
        "Id": 1234567,
        "Business": ,
        "Code": "Code",
        "Description": "Description",
        "Active": false,
        "PublishFrom": ,
        "PublishTo": ,
        "DiscountPercentage": ,
        "DiscountAmount": ,
        "ReferralDiscount": false,
        "DiscountPricePlans": false,
        "DiscountBookings": false,
        "DiscountProducts": false,
        "DiscountEvents": false,
        "MaxUsesPerUser": ,
        "MaxUses": ,
        "OnlyForContacts": false,
        "OnlyForMembers": false,
        "ValidFrom": ,
        "ValidTo": ,
        "ExpirationType": 1,
        "ExpiresIn": ,
        "DiscountCodeBusinessName": "...",
        "DiscountCodeBusinessCurrency_Code": "...",
        "CreatedOn": "2018-07-03T06:23:01Z",
        "UpdatedOn": "2020-01-01T21:57:21Z",
        "UpdatedBy": "System",
        "UniqueId": "8defbba9-1589-44c9-94d0-6607fd3eddc7",
        "SystemId": "{ metadata: { id: 887766, processed: true } }"
    }],
    "CurrentPageSize": 25,
    "CurrentPage": 1,
    "CurrentOrderField": "Code",
    "CurrentSortDirection": 1,
    "FirstItem": 1,
    "HasNextPage": true,
    "HasPreviousPage": false,
    "LastItem": 1,
    "PageNumber": 1,
    "PageSize": 25,
    "TotalItems": 1,
    "TotalPages": 1
}


Get single DiscountCode by Id

Gets one discountcode record by its Id.
GET https://spaces.nexudus.com/api/billing/discountcodes/:Id

πŸ”’ Requires role "DiscountCode-Read"

URL parameters
Id: number requried

Example request

GET https://spaces.nexudus.com/api/billing/discountcodes/1234567
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example response


{
  "Id": 1234567,
  "Active": false,
  "BusinessId": 12345678,
  "Code": "Code",
  "Description": "Description",
  "DiscountAmount": ,
  "DiscountBookings": false,
  "DiscountEvents": false,
  "DiscountPercentage": ,
  "DiscountPricePlans": false,
  "DiscountProducts": false,
  "ExpirationType": 1,
  "ExpiresIn": ,
  "MaxUses": ,
  "MaxUsesPerUser": ,
  "OnlyForContacts": false,
  "OnlyForMembers": false,
  "PublishFrom": ,
  "PublishTo": ,
  "ReferralDiscount": false,
  "ValidFrom": ,
  "ValidTo": ,
  "CreatedOn": "2018-07-03T06:23:01Z",
  "UpdatedOn": "2020-01-01T21:57:21Z",
  "UpdatedBy": "System",
  "UniqueId": "6b93f6ae-26ea-48ac-9840-824ca41f59d3",
  "SystemId": "{ metadata: { id: 887766, processed: true } }"
}


Create new DiscountCode

Creates a new discountcode.
POST https://spaces.nexudus.com/api/billing/discountcodes

πŸ”’ Requires role "DiscountCode-Create"

Body parameters
BusinessId: number required
Code: string required
Description: string required
Active: bool optional
PublishFrom: DateTime? optional
PublishTo: DateTime? optional
DiscountPercentage: decimal? optional
DiscountAmount: decimal? optional
ReferralDiscount: bool optional
DiscountPricePlans: bool optional
DiscountBookings: bool optional
DiscountProducts: bool optional
DiscountEvents: bool optional
MaxUsesPerUser: int? optional
MaxUses: int? optional
OnlyForContacts: bool optional
OnlyForMembers: bool optional
ValidFrom: DateTime? optional
ValidTo: DateTime? optional
ExpirationType: Nexudus.Coworking.Core.Enums.eDiscountExpirePeriod? optional
ExpiresIn: int? optional

Example request

POST https://spaces.nexudus.com/api/billing/discountcodes
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

{
    "BusinessId": 12345678,
    "Code": "Code",
    "Description": "Description",
    "Active": false,
    "PublishFrom": ,
    "PublishTo": ,
    "DiscountPercentage": ,
    "DiscountAmount": ,
    "ReferralDiscount": false,
    "DiscountPricePlans": false,
    "Tariffs": [12345678, 87654321],
    "DiscountBookings": false,
    "ResourceTypes": [12345678, 87654321],
    "DiscountProducts": false,
    "Products": [12345678, 87654321],
    "DiscountEvents": false,
    "EventCategories": [12345678, 87654321],
    "MaxUsesPerUser": ,
    "MaxUses": ,
    "OnlyForContacts": false,
    "OnlyForMembers": false,
    "ValidFrom": ,
    "ValidTo": ,
    "ExpirationType": 1, //(check Enumerated values section below)
    "ExpiresIn": ,
}


Example valid response


{
    "Status": 200,
    "WasSuccessful": true,
    "Message": "Record 'Name of the record' has been succesfully created.",
    "Value": {
        "Id": 12354678
    }
}


Example invalid response


{
    "Status": 500,
    "Message": "Name: may not be null or empty",
    "Value": null,
    "WasSuccessful": false,
    "Errors": [
        {
            "AttemptedValue": null,
            "Message": "may not be null or empty",
            "PropertyName": "Name"
        },
    ]
}


Update DiscountCode

Updates an existing discountcode.
PUT https://spaces.nexudus.com/api/billing/discountcodes

PUT requests require ALL record properties to be submitted with every request. Any missing properties will be cleared or set to false.

πŸ”’ Requires role "DiscountCode-Edit"

Body parameters
Id: number required
The unique Id of the discountcode to update.
BusinessId: number cleared if missing
Code: string cleared if missing
Description: string cleared if missing
Active: bool cleared if missing
PublishFrom: DateTime? cleared if missing
PublishTo: DateTime? cleared if missing
DiscountPercentage: decimal? cleared if missing
DiscountAmount: decimal? cleared if missing
ReferralDiscount: bool cleared if missing
DiscountPricePlans: bool cleared if missing
DiscountBookings: bool cleared if missing
DiscountProducts: bool cleared if missing
DiscountEvents: bool cleared if missing
MaxUsesPerUser: int? cleared if missing
MaxUses: int? cleared if missing
OnlyForContacts: bool cleared if missing
OnlyForMembers: bool cleared if missing
ValidFrom: DateTime? cleared if missing
ValidTo: DateTime? cleared if missing
ExpirationType: Nexudus.Coworking.Core.Enums.eDiscountExpirePeriod? cleared if missing
ExpiresIn: int? cleared if missing

Example request

PUT https://spaces.nexudus.com/api/billing/discountcodes
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

{
    "Id": 12345678,
    "BusinessId": 12345678,
    "Code": "Code",
    "Description": "Description",
    "Active": false,
    "PublishFrom": ,
    "PublishTo": ,
    "DiscountPercentage": ,
    "DiscountAmount": ,
    "ReferralDiscount": false,
    "DiscountPricePlans": false,
    "Tariffs": [12345678, 87654321],
    "DiscountBookings": false,
    "ResourceTypes": [12345678, 87654321],
    "DiscountProducts": false,
    "Products": [12345678, 87654321],
    "DiscountEvents": false,
    "EventCategories": [12345678, 87654321],
    "MaxUsesPerUser": ,
    "MaxUses": ,
    "OnlyForContacts": false,
    "OnlyForMembers": false,
    "ValidFrom": ,
    "ValidTo": ,
    "ExpirationType": 1, //(check Enumerated values section below)
    "ExpiresIn": ,
}


Example valid response


{
    "Status": 200,
    "WasSuccessful": true,
    "Message": "Record 'Name of the record' has been succesfully updated.",
    "Value": {
        "Id": 12354678
    }
}


Example invalid response


{
    "Status": 500,
    "Message": "Name: may not be null or empty",
    "Value": null,
    "WasSuccessful": false,
    "Errors": [
        {
            "AttemptedValue": null,
            "Message": "may not be null or empty",
            "PropertyName": "Name"
        },
    ]
}


Delete DiscountCode

Deletes an existing discountcode by its Id.
DELETE https://spaces.nexudus.com/api/billing/discountcodes/:Id

πŸ”’ Requires role "DiscountCode-Delete"

URL parameters
Id: number required
The unique Id of the discountcode to update.

Example request

DELETE https://spaces.nexudus.com/api/billing/discountcodes/12345678
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example valid response


{
    "Status": 200,
    "WasSuccessful": true,
    "Message": "The record was deleted successfully.",
    "Value": null,
    "OpenInDialog": false,
    "RedirectURL": null,
    "JavaScript": null,
    "Errors": null
}


Commands

Commands allow to perform actions against one or more discountcode records. Some commands accept only one record while others can run an action for a number of records at the same time. Each command has metadata with information about how it can be used and the amount of records, if any, it needs to run.

Get Commands

Get all commands available to run for discountcode records.
GET https://spaces.nexudus.com/api/billing/discountcodes/commands

Example request

GET https://spaces.nexudus.com/api/billing/discountcodes/commands
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example valid response


[
	{
		"Key": "COMMAND_KEY_1",
		"Name": "Command 1 english description",
		"AppliesOnlyToMultipleEntities": false,
		"DisplayInDropdown": true,
		"DisplayInDropdownV2": true,
		"AppliesOnlyToOneEntity": false,
		"AppliesOnlyToTwoEntities": false,
		"DisplayInGrid": false,
		"NeedsEntitiesToRun": true,
		"Order": 2,
		"RequiresParameters": []
	},
	{
		"Key": "COMMAND_KEY_2",
		"Name": "Command 2 english description",
		"AppliesOnlyToMultipleEntities": false,
		"DisplayInDropdown": true,
		"DisplayInDropdownV2": true,
		"AppliesOnlyToOneEntity": true,
		"AppliesOnlyToTwoEntities": false,
		"DisplayInGrid": true,
		"NeedsEntitiesToRun": true,
		"Order": 10,
		"RequiresParameters": 
		[
			{
				"Name": "Parameter 1 description",
				"Type": "string",
			},
			{
				"Name": "Parameter 2 description",
				"Type": "Boolean",
			}
		]
	},
	...
]


Run Command

Runs a command based on its Key and one or more discountcode record IDs.
POST https://spaces.nexudus.com/api/billing/discountcodes/runacommand
πŸ”’ Requires role "DiscountCode-Edit"

Example request

POST https://spaces.nexudus.com/api/billing/discountcodes/runcommand
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

{
	"Ids":[1329961649],
	"Parameters": 
	[
		{ 
			"Type": "string"
			"Value":987654321
		},
		{
			"Type": "Boolean",
			"Value":true
		},
		...
	],
	"Key":"COMMAND_KEY_2"
}


Example valid response


{
	"Errors": null
	"JavaScript": null
	"Message": "Result description"
	"OpenInDialog": false
	"OpenInWindow": false
	"RedirectURL": null
	"Status": 200
	"UpdatedBy": "email@example.net"
	"UpdatedOn: "2020-06-04T11:40:20Z"
	"Value: {Id: 12345678}
	"WasSuccessful: true
}


Enumerated values

ExpirationType

GET /api/utils/enums?name=eDiscountExpirePeriod

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Please sign in to leave a comment.