<p>As I understand, it's not possible to return a value different to unit because the <code>endpoint</code> response always returns unit <code>()</code> <a href="https://github.com/input-output-hk/plutus/blob/master/plutus-pab/src/Plutus/PAB/Webserver/API.hs#L43" rel="nofollow noreferrer">check here in endpoint line</a></p>
<p>Here is the call to <code>endpoint</code>:</p>
<p><code>:&lt;|&gt; &quot;endpoint&quot; :&gt; Capture &quot;endpoint-name&quot; String :&gt; ReqBody '[JSON] JSON.Value :&gt; Description &quot;Call an endpoint.&quot; :&gt; Post '[JSON] ()</code></p>
<p><code>Post</code> receives a <code>JSON</code> with <code>JSON.Value</code> value and returns a <code>JSON</code> with a <code>()</code> value.</p>
<p>Anyway, you can use <code>status</code> to debug and read logs, which returns <code>ContractInstanceClientState</code> including:</p>
<ul>
<li><code>observableState</code></li>
<li><code>logs</code></li>
<li><code>lastLogs</code></li>
</ul>
<p>You call <code>status</code> in this way:
<code>/api/contract/instance/&lt;contract-instance-id&gt;/status</code></p>

CC BY-SA 4.0
2021-10-13T16:20:36.750Z
2021-10-13T16:20:36.750Z
georgeos
<p>Is there a way to return values that are not the unit in JSON form from an endpoint?</p>
<p>Currently, any successful endpoint call over HTTP returns <code>&quot;[]&quot;</code>.</p>
<p>The only way we have to debug content is on the PAB side, from which we can read logs.</p>
<p>Does this have to do with the final parameter of the <code>Contract w s e a</code> where a is generally the unit in most starter PAB code?</p>
<p>According to the docs, a is a semigroup. If we return some type there we still don't get a result from the PAB.</p>

<plutus><plutus-starter><plutus-pab>
Endpoint contract response from PAB
# Endpoint contract response from PAB

(Asked by: username_0 on 2021-10-13)

Is there a way to return values that are not the unit in JSON form from an endpoint?

Currently, any successful endpoint call over HTTP returns `"[]"`.

The only way we have to debug content is on the PAB side, from which we can read logs.

Does this have to do with the final parameter of the `Contract w s e a` where a is generally the unit in most starter PAB code?

According to the docs, a is a semigroup. If we return some type there we still don't get a result from the PAB.

**Tags:** plutus, plutus-starter, plutus-pab

---

## 1 answers

### Answer by username_1 on 2021-10-13. Score: 2 | Accepted answer

As I understand, it's not possible to return a value different to unit because the `endpoint` response always returns unit `()` [check here in endpoint line](https://github.com/input-output-hk/plutus/blob/master/plutus-pab/src/Plutus/PAB/Webserver/API.hs#L43)

Here is the call to `endpoint`:

`:<|> "endpoint" :> Capture "endpoint-name" String :> ReqBody '[JSON] JSON.Value :> Description "Call an endpoint." :> Post '[JSON] ()`

`Post` receives a `JSON` with `JSON.Value` value and returns a `JSON` with a `()` value.

Anyway, you can use `status` to debug and read logs, which returns `ContractInstanceClientState` including:

* `observableState`
* `logs`
* `lastLogs`

You call `status` in this way:
`/api/contract/instance//status`


---

