<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Moinz.de Webservices – Msg</title><link>http://help.moinz.de/docs/msg/</link><description>Recent content in Msg on Moinz.de Webservices</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><atom:link href="http://help.moinz.de/docs/msg/index.xml" rel="self" type="application/rss+xml"/><item><title>Docs: Introduction</title><link>http://help.moinz.de/docs/msg/msg/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://help.moinz.de/docs/msg/msg/</guid><description>
&lt;p>&lt;strong>Msg&lt;/strong> is a simple and small message queue for pushing and polling single messages.
Topics and other more advanced mechanisms are not supported.&lt;/p>
&lt;h2 id="access">Access&lt;/h2>
&lt;p>Endpoint: &lt;code>https://apps.moinz.de/msg/msg.php&lt;/code>&lt;/p>
&lt;h2 id="api">API&lt;/h2>
&lt;p>The API is documented &lt;a href="http://help.moinz.de/docs/msg/api/">here&lt;/a>.&lt;/p></description></item><item><title>Docs: API</title><link>http://help.moinz.de/docs/msg/api/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>http://help.moinz.de/docs/msg/api/</guid><description>
&lt;h2 id="welcome">Welcome&lt;/h2>
&lt;p>A very simple http based message queue inspired by Amazons SNS.&lt;/p>
&lt;h2 id="notation">Notation&lt;/h2>
&lt;ul>
&lt;li>
&lt;p>Each action contains two lists: The request fields and response fields. Please note that the top level of the JSON is always an object.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>The field names may contain dots to intend sub objects. In case the field denotes an array, a single uppercase letter is used, e.g. &lt;code>tags.N.key&lt;/code> means the &lt;code>tags&lt;/code> field contains an array containing more objects with a &lt;code>key&lt;/code> field inside.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>The field table may contain a required column. The notation is as followed:&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Value&lt;/th>
&lt;th>Meaning&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>O&lt;/td>
&lt;td>Optional - the field must not be provided&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>R&lt;/td>
&lt;td>Required&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;/li>
&lt;li>
&lt;p>Currently no pagination is supported.&lt;/p>
&lt;/li>
&lt;/ul>
&lt;h2 id="authorization">Authorization&lt;/h2>
&lt;p>The &lt;code>msg-php&lt;/code> service authorizes requests over htbasic auth. Your credentials will be provided by the service operator.&lt;/p>
&lt;h2 id="datastructures">DataStructures&lt;/h2>
&lt;h3 id="uri">URI&lt;/h3>
&lt;p>URIs are string identifiers for objects inside the &lt;em>msg&lt;/em> service. They generally take the following format: &lt;code>msg:&amp;lt;type&amp;gt;:&amp;lt;unique-id&amp;gt;&lt;/code>. Type is one of &lt;code>queue&lt;/code> or &lt;code>message&lt;/code>.&lt;/p>
&lt;h3 id="queue">Queue&lt;/h3>
&lt;pre tabindex="0">&lt;code>{
&amp;#34;id&amp;#34;: &amp;#34;msg:queue:uuid()&amp;#34;
&amp;#34;tags&amp;#34;: [
{&amp;#34;key&amp;#34;: &amp;#34;Name&amp;#34;, &amp;#34;value&amp;#34;: &amp;#34;Value&amp;#34;},
...
]
}
&lt;/code>&lt;/pre>&lt;h3 id="queuestatus">QueueStatus&lt;/h3>
&lt;pre tabindex="0">&lt;code>{
&amp;#34;id&amp;#34;: &amp;#34;msg:queue:uuid()&amp;#34;,
&amp;#34;messages&amp;#34;: int(),
}
&lt;/code>&lt;/pre>&lt;h3 id="message">Message&lt;/h3>
&lt;pre tabindex="0">&lt;code>{
&amp;#34;id&amp;#34;: &amp;#34;string()&amp;#34;,
&amp;#34;content_type&amp;#34;: &amp;#34;string()&amp;#34;,
&amp;#34;body&amp;#34;: &amp;#34;json escaped query body&amp;#34;,
&amp;#34;created_at&amp;#34;: &amp;#34;ISO8601()&amp;#34;
}
&lt;/code>&lt;/pre>&lt;h3 id="errormessage">ErrorMessage&lt;/h3>
&lt;pre tabindex="0">&lt;code>{
&amp;#34;message&amp;#34;: &amp;#34;string()&amp;#34;,
[&amp;#34;error&amp;#34;: bool(),]
[&amp;#34;detail&amp;#34;: &amp;#34;string()&amp;#34;,]
&amp;#34;code&amp;#34;: int()
}
&lt;/code>&lt;/pre>&lt;h2 id="actions">Actions&lt;/h2>
&lt;p>Generally all actions have the same format. Send a &lt;code>POST&lt;/code> request to &lt;code>https://apps.moinz.de/msg/msg.php&lt;/code> with a query parameter &lt;code>action&lt;/code> of one of the list below. Operation parameters are given via query parameters. Data from the request body is only used when explicitly stated.&lt;/p>
&lt;h3 id="createqueue">CreateQueue&lt;/h3>
&lt;p>Creates a new queue and returns the created queue.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Required&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>tags.N.key&lt;/td>
&lt;td>O&lt;/td>
&lt;td>The key for the tag. &lt;code>N&lt;/code> must be replaced with a sequential number starting at 1 with a maximum of 20.&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>tags.N.value&lt;/td>
&lt;td>O&lt;/td>
&lt;td>The value of the tag.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>Queue&lt;/td>
&lt;td>The queue that was created&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;p>Example&lt;/p>
&lt;pre tabindex="0">&lt;code>POST /msg/msg.php?action=CreateQueue&amp;amp;tags.1.key=name&amp;amp;tags.1.value=example-queue&amp;amp;tags.2.key=env&amp;amp;tags.2.value=production
Content-Length: 0
200 OK
Content-Type: application/json
{
&amp;#34;queue&amp;#34; : {
&amp;#34;id&amp;#34;: &amp;#34;msg:queue:1234-56789-01234-5678&amp;#34;,
&amp;#34;tags&amp;#34;: {
&amp;#34;name&amp;#34;: &amp;#34;example-queue&amp;#34;,
&amp;#34;env&amp;#34;: &amp;#34;production&amp;#34;
}
}
}
&lt;/code>&lt;/pre>&lt;h3 id="describequeues">DescribeQueues&lt;/h3>
&lt;p>DescribeQueues fetches a list of Queues and returns them with their ids and tags to the client.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>filter.tag:key&lt;/td>
&lt;td>Filters for queues having &lt;code>key&lt;/code> as a tag with the given value as the value.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queues&lt;/td>
&lt;td>[]Queue&lt;/td>
&lt;td>The queues that match the given filters&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="deletequeue">DeleteQueue&lt;/h3>
&lt;p>DeleteQueue deletes the specified queue and all messages contained within it.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>the URI of the queue to delete&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>Queue&lt;/td>
&lt;td>The queue that was deleted&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="describequeuestatus">DescribeQueueStatus&lt;/h3>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>The URI of the queue to fetch the message from&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>id&lt;/td>
&lt;td>URI&lt;/td>
&lt;td>The URI of the queue&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>messages&lt;/td>
&lt;td>int&lt;/td>
&lt;td>Number of messages in the queue&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="updatequeuetags">UpdateQueueTags&lt;/h3>
&lt;p>Updates the tags for the specified queue.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>The URI of the queue to fetch the message from&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>tags.N.key&lt;/td>
&lt;td>The key for the tag&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>tags.N.value&lt;/td>
&lt;td>The value of the tag&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>Queue&lt;/td>
&lt;td>The queue that got updated&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="purgequeue">PurgeQueue&lt;/h3>
&lt;p>PurgeQueue removes all messages currently stored in the queue.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>The URI of the queue to fetch the message from&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>[]Queue&lt;/td>
&lt;td>The queue that was purged&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="pushmessage">PushMessage&lt;/h3>
&lt;p>Creates a new message in the given queue. The body of the reuqest is taken as the message body, the request
content-type is saved along.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>The URI of the queue to push into&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>URI&lt;/td>
&lt;td>The URI of the queue the message was pushed into&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>message&lt;/td>
&lt;td>URI&lt;/td>
&lt;td>The URI of the message that was pushed&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>content-md5&lt;/td>
&lt;td>string&lt;/td>
&lt;td>MD5 hash of the request body&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h3 id="popmessage">PopMessage&lt;/h3>
&lt;p>Returns a message and deletes it from the queue. If no message can be found, &lt;code>null&lt;/code> is returned for the &lt;code>message&lt;/code> field.&lt;/p>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Query Parameters&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>The URI of the queue to fetch the message from&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;table>
&lt;thead>
&lt;tr>
&lt;th>Response Fields&lt;/th>
&lt;th>Type&lt;/th>
&lt;th>Description&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>
&lt;tr>
&lt;td>queue&lt;/td>
&lt;td>URI&lt;/td>
&lt;td>The URI of the queue&lt;/td>
&lt;/tr>
&lt;tr>
&lt;td>message&lt;/td>
&lt;td>Message&lt;/td>
&lt;td>The messages that was dequeued&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="common-errors">Common Errors&lt;/h2>
&lt;h3 id="invalid-method">Invalid Method&lt;/h3>
&lt;p>Since the &lt;em>msg&lt;/em> service takes only POST requests, all other http methods are quit with a &lt;code>405&lt;/code> error.&lt;/p>
&lt;h3 id="invalid-action">Invalid Action&lt;/h3>
&lt;p>StatusCode: 400
If the &lt;code>action&lt;/code> parameter is unknown.&lt;/p>
&lt;h3 id="invalid-request">Invalid Request&lt;/h3>
&lt;p>Most actions require a &lt;code>queue&lt;/code> parameter. If it is missing, the &lt;em>msg&lt;/em> services responds with a &lt;code>ErrorMessage&lt;/code> and a 400 status code.&lt;/p>
&lt;h3 id="queuenotfound">QueueNotFound&lt;/h3>
&lt;p>When the specified &lt;code>queue&lt;/code> cannot be found, an &lt;code>ErrorMessage&lt;/code> and a &lt;code>404&lt;/code> is returned.&lt;/p>
&lt;h3 id="internal-server-error">Internal Server Error&lt;/h3>
&lt;p>If an unexpected error occurs, an &lt;code>ErrorMessage&lt;/code> with the text &amp;ldquo;Internal Server Error&amp;rdquo; and a &lt;code>500&lt;/code> status code is returned.&lt;/p>
&lt;h2 id="authorization-1">Authorization&lt;/h2>
&lt;p>Authorization is simply handled via htbasic auth as defined in the HTTP protocol.&lt;/p>
&lt;h2 id="permissions">Permissions&lt;/h2>
&lt;p>Like the &lt;em>fs-php&lt;/em> service, &lt;em>msg&lt;/em> supports policies to fine tune access to actions and/or resources for special users.&lt;/p>
&lt;p>All actions are prefixed with &lt;code>msg::&lt;/code> and contain the name listed above, e.g. &lt;code>msg::DescribeQueues&lt;/code>, &lt;code>msg::PushMessage&lt;/code>.
All resource names start with &lt;code>msg:&lt;/code> followed by the type and a unique id, e.g. &lt;code>msg:queue:123ac12&lt;/code> or &lt;code>msg:message:123141231&lt;/code>. Actions that do no work on a specific resource, use the resource &lt;code>msg:*&lt;/code>.&lt;/p>
&lt;h3 id="examples">Examples&lt;/h3>
&lt;pre tabindex="0">&lt;code>$accessManager-&amp;gt;newPolicy()
-&amp;gt;description(&amp;#39;Eve may push into the &amp;#39;)
-&amp;gt;forUsername(&amp;#39;eve&amp;#39;)
-&amp;gt;permission(&amp;#39;msg::PushMessage&amp;#39;)
-&amp;gt;forResource(&amp;#39;msg:queue:bf54e8c38a1dbe21246e268ab3109aff&amp;#39;);
$accessManager-&amp;gt;newPolicy()
-&amp;gt;description(&amp;#39;Bob may only check queues and consume messages&amp;#39;)
-&amp;gt;forUsername(&amp;#39;bob&amp;#39;)
-&amp;gt;permission(&amp;#39;msg::Describe*&amp;#39;)
-&amp;gt;forPermission(&amp;#39;msg::PopMessage&amp;#39;)
-&amp;gt;forResource(&amp;#39;msg:*&amp;#39;);
&lt;/code>&lt;/pre></description></item></channel></rss>