<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.socialstack.dev/index.php?action=history&amp;feed=atom&amp;title=API_Modules</id>
	<title>API Modules - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.socialstack.dev/index.php?action=history&amp;feed=atom&amp;title=API_Modules"/>
	<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=API_Modules&amp;action=history"/>
	<updated>2026-10-16T01:15:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.36.2</generator>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=104&amp;oldid=prev</id>
		<title>2A02:C7F:22BE:A500:498:3225:1A16:A72D: /* ThingController.cs */</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=104&amp;oldid=prev"/>
		<updated>2022-07-06T01:30:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;ThingController.cs&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:30, 6 July 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= ThingController.cs =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= ThingController.cs =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Controllers are the web API endpoints and effectively represent the main user facing frontage of your site. Just like with services, the controllers have a series of [[public &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Api&lt;/del&gt;|common convenience endpoints]] which are usually accessed with webRequest or [[Loop|Loop]] on the frontend.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Controllers are the web API endpoints and effectively represent the main user facing frontage of your site. Just like with services, the controllers have a series of [[public &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;API&lt;/ins&gt;|common convenience endpoints]] which are usually accessed with webRequest or [[Loop|Loop]] on the frontend.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Permissions.cs =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Permissions.cs =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>2A02:C7F:22BE:A500:498:3225:1A16:A72D</name></author>
	</entry>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=103&amp;oldid=prev</id>
		<title>2A02:C7F:22BE:A500:498:3225:1A16:A72D: /* ThingController.cs */</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=103&amp;oldid=prev"/>
		<updated>2022-07-06T01:30:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;ThingController.cs&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:30, 6 July 2022&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l19&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= ThingController.cs =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= ThingController.cs =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Controllers are the web API endpoints and effectively represent the main user facing frontage of your site. Just like with services, the controllers have a series of common convenience endpoints which are usually accessed with webRequest or [[Loop|Loop]] on the frontend.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Controllers are the web API endpoints and effectively represent the main user facing frontage of your site. Just like with services, the controllers have a series of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[public Api|&lt;/ins&gt;common convenience endpoints&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;which are usually accessed with webRequest or [[Loop|Loop]] on the frontend.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Permissions.cs =&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Permissions.cs =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>2A02:C7F:22BE:A500:498:3225:1A16:A72D</name></author>
	</entry>
	<entry>
		<id>https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=96&amp;oldid=prev</id>
		<title>2A02:C7F:22BE:A500:498:3225:1A16:A72D: Created page with &quot;A newly regularly generated API module has 5 files. Assuming you did &#039;&#039;&#039;socialstack generate Api/Things&#039;&#039;&#039;, here&#039;s what each of them is for:  = Events.cs =  When something hap...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.socialstack.dev/index.php?title=API_Modules&amp;diff=96&amp;oldid=prev"/>
		<updated>2022-07-05T17:16:43Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;A newly regularly generated API module has 5 files. Assuming you did &amp;#039;&amp;#039;&amp;#039;socialstack generate Api/Things&amp;#039;&amp;#039;&amp;#039;, here&amp;#039;s what each of them is for:  = Events.cs =  When something hap...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A newly regularly generated API module has 5 files. Assuming you did &amp;#039;&amp;#039;&amp;#039;socialstack generate Api/Things&amp;#039;&amp;#039;&amp;#039;, here&amp;#039;s what each of them is for:&lt;br /&gt;
&lt;br /&gt;
= Events.cs =&lt;br /&gt;
&lt;br /&gt;
When something happens in your API, an event is triggered. By default all entities have a common set of events for things like creation/ updates/ deletion etc, but it can be extended by defining a custom event type. This is detailed more on [[Events|the page about events]]. One of the core goals of events in SocialStack is for them to be extremely fast and also easy to use with IDE autofilling, so these auto generated files exist to enable those statically typed naming in the form of Events.Thing.BeforeCreate and so on.&lt;br /&gt;
&lt;br /&gt;
Event handlers, including for a services own content type, are typically added inside service constructors.&lt;br /&gt;
&lt;br /&gt;
= Thing.cs =&lt;br /&gt;
&lt;br /&gt;
This is the entity description file. It describes what fields are on the entity. In a nutshell, fields are stored in the database and properties are not. There are some conveniences around field naming which is described on [[Entities|the entities page]].&lt;br /&gt;
&lt;br /&gt;
= ThingService.cs =&lt;br /&gt;
&lt;br /&gt;
The [[services|service]], a singleton (instanced once at startup), is used for getting/ listing/ deleting/ updating/ creating an entity. For example if you want to get hold of a user&amp;#039;s information, you would ask the UserService. Services support C# dependency injection but can also be obtained via &amp;#039;&amp;#039;&amp;#039;Services.Get&amp;lt;UserService&amp;gt;()&amp;#039;&amp;#039;&amp;#039;, with Services in the Startup namespace.&lt;br /&gt;
&lt;br /&gt;
Often, event handlers are placed inside the service&amp;#039;s constructor in order to validate your entity or e.g. add custom field values to it whilst it is being created. It&amp;#039;s very common for e.g. ThingService to have Events.Thing.BeforeUpdate and so on inside its own constructor - this allows flexibility in the form of other modules actually unregistering those handlers, if it has a goal of heavily overriding default behaviours.&lt;br /&gt;
&lt;br /&gt;
= ThingController.cs =&lt;br /&gt;
&lt;br /&gt;
Controllers are the web API endpoints and effectively represent the main user facing frontage of your site. Just like with services, the controllers have a series of common convenience endpoints which are usually accessed with webRequest or [[Loop|Loop]] on the frontend.&lt;br /&gt;
&lt;br /&gt;
= Permissions.cs =&lt;br /&gt;
&lt;br /&gt;
This file is used to define the installable, base permissions for your module. It should represent the most common scenario that you expect to happen. For example, password resets should never be publicly visible - and that is going to be quite universal on most websites. These base permission grants can however be overridden in the admin panel, or with other event listeners. When creating permission grants in code, they should target the core roles, particularly if the intent is to make a portable module which can be copied or installed easily on to other projects.&lt;br /&gt;
&lt;br /&gt;
For more information on what the roles are and how the grants work, take a look at the [[permissions|permissions article]].&lt;/div&gt;</summary>
		<author><name>2A02:C7F:22BE:A500:498:3225:1A16:A72D</name></author>
	</entry>
</feed>