Webhook

The webhook object

Attributes
Id: int required, autogenerated, unique
The unique identifier for this webhook
Action: Nexudus.Coworking.Core.Enums.eWebhookAction optional
Active: bool optional
BusinessId: Id required
Description: string optional
ErrorCount: int required read-only
LastError: string optional read-only
LastTrigger: DateTime? optional read-only
Name: string required
URL: string required
UniqueId: Guid required, autogenerated, unique
The globally unique identifier for this webhook
SystemId: string optional api-only
User defined data about this webhook. This property can only be seen and updated using the API.

Json Structure Example


{
  "Id": 1234567,
  "Action": 1,
  "Active": false,
  "BusinessId": 12345678,
  "Description": "Abc123456",
  "ErrorCount": ,
  "LastError": "00001",
  "LastTrigger": ,
  "Name": "00001",
  "URL": "00001",
  "UniqueId": "e267ee8a-15eb-49d5-a156-bb132fb27d26",
  "SystemId": "{ metadata: { id: 887766, processed: true } }"
}


Find a WebHook

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

GET https://spaces.nexudus.com/api/sys/webhooks?...

πŸ”’ Requires role "WebHook-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=Id
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 webhook records based on their different properties.
Id number
?Id=12345678
WebHook_Action Nexudus.Coworking.Core.Enums.eWebhookAction
?WebHook_Action=...
WebHook_Active bool
?WebHook_Active=...
WebHook_Business Business
?WebHook_Business=...
WebHook_Description string
?WebHook_Description=...
WebHook_ErrorCount int
?WebHook_ErrorCount=...
WebHook_LastError string
?WebHook_LastError=...
WebHook_LastTrigger DateTime?
?WebHook_LastTrigger=...
WebHook_Name string
?WebHook_Name=...
WebHook_URL string
?WebHook_URL=...

Range search querystring parameters
Lets you search webhook records based on a range of date or numeric values.
To_WebHook_CreatedOn date
?To_WebHook_CreatedOn=2010-01-01T20:32
From_WebHook_CreatedOn date
?From_WebHook_CreatedOn=2010-01-01T20:32
To_WebHook_UpdatedOn date
?To_WebHook_UpdatedOn=2010-01-01T20:32
From_WebHook_UpdatedOn date
?From_WebHook_UpdatedOn=2010-01-01T20:32
To_WebHook_ErrorCount number
?To_WebHook_ErrorCount=0
From_WebHook_ErrorCount number
?From_WebHook_ErrorCount=10
To_WebHook_LastTrigger date
?To_WebHook_LastTrigger=2010-01-01T20:32
From_WebHook_LastTrigger date
?From_WebHook_LastTrigger=2010-01-01T20:32

Example request

GET https://spaces.nexudus.com/api/sys/webhooks?WebHook_Name=...
Content-Type: application/json
Authentication: Basic ZXhhbXBsZUBuZXh1ZHVzLmNvbTpFeGFtcGxlMTIzNA==

Example response


{
    "Records": [{
        "Id": 1234567,
        "Business": ,
        "Name": "00001",
        "Action": 1,
        "Description": "Abc123456",
        "URL": "00001",
        "Active": false,
        "LastError": "00001",
        "ErrorCount": ,
        "LastTrigger": ,
        "CreatedOn": "2018-07-03T06:23:01Z",
        "UpdatedOn": "2020-01-01T21:57:21Z",
        "UpdatedBy": "System",
        "UniqueId": "8cf05284-7a1d-4929-821a-0aa650bdf0ea",
        "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 WebHooks by IDs

Gets one or more webhook records based on their Id.
GET https://spaces.nexudus.com/api/sys/webhooks?WebHook_Id=[:id1,:id2,...]

πŸ”’ Requires role "WebHook-List"

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

Example request

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

Example response


{
    "Records": [{
        "Id": 1234567,
        "Business": ,
        "Name": "00001",
        "Action": 1,
        "Description": "Abc123456",
        "URL": "00001",
        "Active": false,
        "LastError": "00001",
        "ErrorCount": ,
        "LastTrigger": ,
        "CreatedOn": "2018-07-03T06:23:01Z",
        "UpdatedOn": "2020-01-01T21:57:21Z",
        "UpdatedBy": "System",
        "UniqueId": "61bb872b-9e24-49a4-a117-528374e45f16",
        "SystemId": "{ metadata: { id: 887766, processed: true } }"
    }],
    "CurrentPageSize": 25,
    "CurrentPage": 1,
    "CurrentOrderField": "Id",
    "CurrentSortDirection": 1,
    "FirstItem": 1,
    "HasNextPage": true,
    "HasPreviousPage": false,
    "LastItem": 1,
    "PageNumber": 1,
    "PageSize": 25,
    "TotalItems": 1,
    "TotalPages": 1
}


Get single WebHook by Id

Gets one webhook record by its Id.
GET https://spaces.nexudus.com/api/sys/webhooks/:Id

πŸ”’ Requires role "WebHook-Read"

URL parameters
Id: number requried

Example request

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

Example response


{
  "Id": 1234567,
  "Action": 1,
  "Active": false,
  "BusinessId": 12345678,
  "Description": "Abc123456",
  "ErrorCount": ,
  "LastError": "00001",
  "LastTrigger": ,
  "Name": "00001",
  "URL": "00001",
  "CreatedOn": "2018-07-03T06:23:01Z",
  "UpdatedOn": "2020-01-01T21:57:21Z",
  "UpdatedBy": "System",
  "UniqueId": "9ec56585-ea33-4876-89ff-3350254da9d4",
  "SystemId": "{ metadata: { id: 887766, processed: true } }"
}


Create new WebHook

Creates a new webhook.
POST https://spaces.nexudus.com/api/sys/webhooks

πŸ”’ Requires role "WebHook-Create"

Body parameters
BusinessId: number required
Name: string required
Action: Nexudus.Coworking.Core.Enums.eWebhookAction optional
Description: string optional
URL: string required
Active: bool optional

Example request

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

{
    "BusinessId": 12345678,
    "Name": "00001",
    "Action": 1, //(check Enumerated values section below)
    "Description": "Abc123456",
    "URL": "00001",
    "Active": false,
}


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 WebHook

Updates an existing webhook.
PUT https://spaces.nexudus.com/api/sys/webhooks

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

πŸ”’ Requires role "WebHook-Edit"

Body parameters
Id: number required
The unique Id of the webhook to update.
BusinessId: number cleared if missing
Name: string cleared if missing
Action: Nexudus.Coworking.Core.Enums.eWebhookAction cleared if missing
Description: string cleared if missing
URL: string cleared if missing
Active: bool cleared if missing

Example request

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

{
    "Id": 12345678,
    "BusinessId": 12345678,
    "Name": "00001",
    "Action": 1, //(check Enumerated values section below)
    "Description": "Abc123456",
    "URL": "00001",
    "Active": false,
}


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 WebHook

Deletes an existing webhook by its Id.
DELETE https://spaces.nexudus.com/api/sys/webhooks/:Id

πŸ”’ Requires role "WebHook-Delete"

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

Example request

DELETE https://spaces.nexudus.com/api/sys/webhooks/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 webhook 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 webhook records.
GET https://spaces.nexudus.com/api/sys/webhooks/commands

Example request

GET https://spaces.nexudus.com/api/sys/webhooks/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 webhook record IDs.
POST https://spaces.nexudus.com/api/sys/webhooks/runacommand
πŸ”’ Requires role "WebHook-Edit"

Example request

POST https://spaces.nexudus.com/api/sys/webhooks/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

Action

GET /api/utils/enums?name=eWebhookAction

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.