Class NSWebhookAgent
Webhook definitions* webhooks signal other systems about events inside NetServer.
Syntax
Examples
NSWebhookAgent agent;
agent.callMethod(arg1, arg2);
Constructors
NSWebhookAgent()
Introduced or updated in version: 8.2
Declaration
NSWebhookAgent
Examples
NSWebhookAgent agent;
agent.callMethod(arg1, arg2);
Methods
CreateDefaultWebhook()
Sets default values into a new NSWebhook.
Introduced or updated in version: 8.2
Declaration
NSWebhook CreateDefaultWebhook()
Returns
Type | Description |
---|---|
NSWebhook | A new NSWebhook with default values. |
Remarks
NetServer calculates default values (for example, Country) on the entity, which is required when creating/storing a new instance
Examples
NSWebhookAgent agent;
NSWebhook thing = agent.CreateDefaultWebhook();
thing = agent.SaveWebhook(thing);
DeleteWebhook(Integer)
Deletes the NSWebhook
Introduced or updated in version: 8.2
Declaration
DeleteWebhook(Integer webhook)
Parameters
Type | Name | Description |
---|---|---|
Integer | webhook |
Returns
Type | Description |
---|---|
Void |
Examples
NSWebhookAgent agent;
agent.DeleteWebhook(123);
GetAllWebhooks(String,String,Integer)
Returns all webhooks, according to filter criteria
Introduced or updated in version: 8.2
Declaration
NSWebhook[] GetAllWebhooks(String nameFilter, String eventFilter, Integer statusFilter)
Parameters
Type | Name | Description |
---|---|---|
String | nameFilter | |
String | eventFilter | |
Integer | statusFilter | See WebhookState. |
Returns
Type | Description |
---|---|
NSWebhook[] |
Examples
NSWebhookAgent agent;
String nameFilter;
String eventFilter;
Integer statusFilter;
NSWebhook[] res = agent.GetAllWebhooks(nameFilter, eventFilter, statusFilter);
GetLastError(Integer)
Return the most recent error message received when calling this webhook.
Introduced or updated in version: 8.2
Declaration
String GetLastError(Integer webhookId)
Parameters
Type | Name | Description |
---|---|---|
Integer | webhookId |
Returns
Type | Description |
---|---|
String |
Examples
NSWebhookAgent agent;
Integer webhookId;
String res = agent.GetLastError(webhookId);
GetWebhook(Integer)
Gets an NSWebhook object.
Introduced or updated in version: 8.2
Declaration
NSWebhook GetWebhook(Integer webhookId)
Parameters
Type | Name | Description |
---|---|---|
Integer | webhookId |
Returns
Type | Description |
---|---|
NSWebhook |
Examples
NSWebhookAgent agent;
NSWebhook thing = agent.GetWebhook(123);
SaveWebhook(NSWebhook)
Updates the existing NSWebhook or creates a new NSWebhook if the id parameter is 0
Introduced or updated in version: 8.2
Declaration
NSWebhook SaveWebhook(NSWebhook webhook)
Parameters
Type | Name | Description |
---|---|---|
NSWebhook | webhook | The NSWebhook to save. |
Returns
Type | Description |
---|---|
NSWebhook |
Examples
NSWebhook agent;
NSWebhook thing = agent.CreateDefaultWebhook();
thing = agent.SaveWebhook(thing);
SignalEvent(String,Integer,StringObjectDictionary)
Signal webhooks that an event has occurred. All webhooks listening for the event will be notified.
Introduced or updated in version: 10.1.2
Declaration
Void SignalEvent(String eventName, Integer primaryKey, StringObjectDictionary data)
Parameters
Type | Name | Description |
---|---|---|
String | eventName | |
Integer | primaryKey | |
StringObjectDictionary | data |
Returns
Type | Description |
---|---|
Void |
Examples
NSWebhookAgent agent;
String eventName;
Integer primaryKey;
StringObjectDictionary data;
agent.SignalEvent(eventName, primaryKey, data);
TestWebhook(NSWebhook)
Pings a webhook with a 'test' event, returns SUCCESS(true) or FAILURE(false) + the response from the webhook target.
Introduced or updated in version: 8.2
Declaration
NSWebhookResult TestWebhook(NSWebhook webhook)
Parameters
Type | Name | Description |
---|---|---|
NSWebhook | webhook |
Returns
Type | Description |
---|---|
NSWebhookResult |
Examples
NSWebhookAgent agent;
NSWebhook webhook;
NSWebhookResult res = agent.TestWebhook(webhook);