# REST API implementation -- a working example

**URL:** <https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003>\
**Category:** Help!\
**Created:** [May 31, 2021, 3:37am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003 "2021-05-31T03:37:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [May 31, 2021, 3:37am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003/1 "2021-05-31T03:37:01Z")

</div>

Hello,

I am looking to implement a REST API to make predicates callable from the outside, to help me get started i am looking for a small complete example – i searched but didn’t find yet any.

Is there perhaps an example out there that i could look at, to learn from …

Edit: Btw, has there been some interfacing efforts with Kotlin – while its a Java VM language it has some special constructions for external extensions.

thanks,

Dan

---

<div class="post-metadata">

**Author:** ![Boris](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/boris/32/7486_2.png) [@Boris](https://swi-prolog.discourse.group/u/Boris)\
**Post date:** [May 31, 2021, 5:46am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003/2 "2021-05-31T05:46:30Z")

</div>

> [@grossdan](#):
>
> I am looking to implement a REST API to make predicates callable from the outside

You don’t really want to use a REST API for that, do you? I would have thought that a REST API is if you want to **not** actually have the whole RPC thing?

---

<div class="post-metadata">

**Author:** ![grossdan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/grossdan/32/23_2.png) [@grossdan](https://swi-prolog.discourse.group/u/grossdan)\
**Post date:** [May 31, 2021, 5:49am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003/3 "2021-05-31T05:49:46Z")

</div>

Hi Boris,

I am looking mirror a REST API provided by another product, in order to reimplement it in Prolog.

Dan

---

<div class="post-metadata">

**Author:** ![CapelliC](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/capellic/32/17_2.png) [@CapelliC](https://swi-prolog.discourse.group/u/CapelliC)\
**Post date:** [May 31, 2021, 9:26am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003/4 "2021-05-31T09:26:06Z")

</div>

Have you already examined Sam Neaves’ [Reactome Pengine](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6084589/) ? Maybe too complex for an easy start, but Sam has demonstrated a genuine interest for Prolog, and he has been active on this list. So, what could be better than that ?

---

<div class="post-metadata">

**Author:** ![peter.ludemann](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/peter.ludemann/32/48_2.png) [@peter.ludemann](https://swi-prolog.discourse.group/u/peter.ludemann)\
**Post date:** [June 1, 2021, 12:04am UTC](https://swi-prolog.discourse.group/t/rest-api-implementation-a-working-example/4003/5 "2021-06-01T00:04:20Z")

</div>

In case it’s useful, I have a sample Javascript client talking to a swipl server (using javascript fetch, so I think it’s standard HTTP and JSON).

> **[kamahen/swipl-server-js-client](https://github.com/kamahen/swipl-server-js-client)**
>
> Sample SWI-Prolog server with JavaScript client. Contribute to kamahen/swipl-server-js-client development by creating an account on GitHub.
