# Public Requests

## Overview

<table><thead><tr><th width="271">Purpose</th><th width="188">Message Type</th><th width="138">Icon Glyph</th><th>File Prefix</th></tr></thead><tbody><tr><td>Send message to Worker from external source</td><td>Asynchronous</td><td><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2F8LyMTjct3fGlgT5Rs9rG%2Fimage.png?alt=media&#x26;token=63ccb7a2-1561-47e6-a885-852dd6a6ea50" alt="" data-size="line"></td><td>rqp_</td></tr></tbody></table>

{% hint style="success" %}
The images below are taken from the [Workers Fundamentals](https://docs.workersforlabview.io/getting-started/example-projects) example project.
{% endhint %}

## Public Request Purpose

A Public Request is a message that can be sent to a Worker from an external source, such as from a Worker's Caller (within a Workers application), from another LabVIEW application or framework, or from TestStand.&#x20;

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FIaOUPEjcuBKcHzlKvyDO%2Fimage.png?alt=media&#x26;token=0ec5f91c-23db-4d70-85d8-20c5eb01ecda" alt="" width="266"><figcaption><p>A Public Request is a message that can be sent to a Worker from an external source</p></figcaption></figure>

## Public Request usage example

The image below demonstrates the use of a Public Request VI sending a message from a MHL case of Worker A to a MHL case of Worker B. In order for the Public Request VI to know which instance of Worker B to send a message to, the Worker's [Handle](https://docs.workersforlabview.io/fundamental-concepts/important-terms#worker-handles) must be wired to the top-left input terminal of the Public Request VI.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FTGTmZL1MJHrNU58c74Ys%2Fimage.png?alt=media&#x26;token=5676cd73-201f-47ba-91bd-014369305d93" alt=""><figcaption><p>Worker A : Main.vi - Public Request VI example</p></figcaption></figure>

## Public Request VI

A Public Request VI is required to be wired in-line with a Caller's [Main Data Wire](https://docs.workersforlabview.io/fundamental-concepts/important-terms#worker-main-data-wire), as shown in the block diagram image above. The Public Request VI will send a message to the Worker who's data wire is connected to its top-left input terminal. The message will be received by the Worker's MHL case that has the same name as the Request VI.

Every Public Request VI filename takes the prefix: **rqp\_** (**r**e**q**uest **p**ublic). Every Public Request VI icon contains a green glyph <img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2F8LyMTjct3fGlgT5Rs9rG%2Fimage.png?alt=media&#x26;token=63ccb7a2-1561-47e6-a885-852dd6a6ea50" alt="" data-size="line"> in its bottom-right corner. An example of a Public Request VI is shown below.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2FxpbrZCPCzIRumSUpOk8m%2Fimage.png?alt=media&#x26;token=8993a560-392e-411e-9489-04942a6f78da" alt=""><figcaption><p>Worker B : rqp_Return Number.vi</p></figcaption></figure>

#### Data in

Data that will be sent along with the message. By default, this is a [typedef ](#local-request-typedef)that has the same filename as the Public Request VI.

#### Message Priority

The [priority](https://docs.workersforlabview.io/fundamental-concepts/priority-queue) of the message (default is Normal) can be set to either Low, Normal or High.

#### Show in Debugger?

When this flag is TRUE, then meta-data about this message will be sent to the [Workers Debug Server](https://docs.workersforlabview.io/workers-tools/workers-tools-menu/workers-debug-server).

## Public Request Typedef

Public Request typedefs are created with the same icon and filename as their matching Public Request VI. Their purpose is to provide a custom container (cluster) for the data that will be sent along with the message to the Public Request's MHL case.

## Public Request MHL Cases

For every Public Request, a MHL case will be created to receive the message sent by the Public Request VI. Public Request MHL cases will automatically be added to the Worker's case structure section called **--- PUBLIC API CASES ---**. To convert the data sent with the message to its specific data type, a Variant to Data node is required at the beginning of every Public Request MHL case (this will automatically be added to the MHL case when the MHL case is created by the [Public API Builder tool](https://docs.workersforlabview.io/workers-tools/workers-tools-menu/public-api-builder)).

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2F0pI44cDPjivFEmIQJRYd%2Fimage.png?alt=media&#x26;token=c0385457-0fef-46a2-a4d7-fe10a7c4056b" alt=""><figcaption><p>Worker B : Main.vi - Public Request MHL cases</p></figcaption></figure>

## Public Request Folders

Public Request VIs created by the [Public API Builder tool](https://docs.workersforlabview.io/workers-tools/workers-tools-menu/public-api-builder) are added to a Worker's *Public API >> Requests* folder. Their scope is set to *public* because they are designed to be used from code that is external to the Worker that owns them.

<figure><img src="https://2767648102-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZWihGdeYUalj239OUdAB%2Fuploads%2F2yKqZFES2vZwqxeEHu1V%2Fimage.png?alt=media&#x26;token=49cca846-e333-49ca-ae60-6bce5340fcca" alt="" width="563"><figcaption><p> Public Request folder structure within a Worker</p></figcaption></figure>
