# How to reference External API to point to localhost

**URL:** <https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610>\
**Category:** Q&A\
**Created:** [29 June 2017 22:46 UTC](https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610 "2017-06-29T22:46:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![afotav](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@afotav](https://community.ofelia.com/u/afotav)\
**Post date:** [29 June 2017 22:46 UTC](https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610/1 "2017-06-29T22:46:12Z")

</div>

Hi,

I have my variables as external API pointing to http:// **localhost** :_xxxx_/rest\_command  
When I access the bonita application pages directly from this server I get the data right, since the service _xxxx_ is running in this server.  
When I do it from a browser in other pc, it retrieves nothing.

It looks like it is doing the **localhost** in the client where the application page is opened, thus retrieving nothing since there is no service _xxxx_ there.  
If I point the variable to http:// **server\_name\_or\_ip** /rest\_command, it works fine.

Is there a way to refer to the own server so I don’t need to change all the server references, when going productive ?

Thanks  
Afotav

---

<div class="post-metadata">

**Author:** ![Sean\_McP](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/sean_mcp/32/932_2.png) [@Sean\_McP](https://community.ofelia.com/u/Sean_McP)\
**Post date:** [2 July 2017 08:39 UTC](https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610/2 "2017-07-02T08:39:32Z")

</div>

Use …/api/command

That should do it.

It should reference the server correctly

regards  
Seán

PS: As this reply answers your question, please mark as resolved.

---

<div class="post-metadata">

**Author:** ![afotav](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@afotav](https://community.ofelia.com/u/afotav)\
**Post date:** [3 July 2017 22:14 UTC](https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610/3 "2017-07-03T22:14:18Z")

</div>

Hi Sean,

I am using a Postgres server, with a REST addon.  
For normal tables it works to reference something like …/API/bdm/BusinessData/com.company.model. **Table**?p=0&c=5&q=find  
However I need to address a view with some field filters, and I’ve tried some flavors of this syntax, without success.  
Example:  
…/API/bdm/BusinessData/com.company.model. **View**?f= **Field1** =value&f= **Field2** =value

Do you think this should really work in Bonita ? If so I’ll keep on trying.

Thanks,

Afo.

---

<div class="post-metadata">

**Author:** ![afotav](https://avatars.discourse-cdn.com/v4/letter/a/858c86/32.png) [@afotav](https://community.ofelia.com/u/afotav)\
**Post date:** [6 July 2017 00:20 UTC](https://community.ofelia.com/t/how-to-reference-external-api-to-point-to-localhost/8610/4 "2017-07-06T00:20:37Z")

</div>

The only way I could do that for Views in a Postgres database, was to use the absolute host name like [http://servername](http://servername):xxx/REST\_COMMAND.  
It’s a pain, when one has to switch server name…

Thanks.
