# Starting with multiples services on rest server

**URL:** <https://www.dolibarr.org/forum/t/starting-with-multiples-services-on-rest-server/18612>\
**Category:** Developing for Dolibarr\
**Tags:** v10, Windows\
**Created:** [February 20, 2020, 8:43am UTC](https://www.dolibarr.org/forum/t/starting-with-multiples-services-on-rest-server/18612 "2020-02-20T08:43:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex-blanes](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/a/45deac/32.png) [@alex-blanes](https://www.dolibarr.org/forum/u/alex-blanes)\
**Post date:** [February 20, 2020, 8:43am UTC](https://www.dolibarr.org/forum/t/starting-with-multiples-services-on-rest-server/18612/1 "2020-02-20T08:43:08Z")

</div>

Hello,  
I’m current developing a Dolibarr module for my ERP subject at the high-degree.  
The module is working with four objects with some relations between them. I created some examples and they work without problem. I want a rest service to work with a java interface that access to this module objects.  
I’m trying to follow this [post](https://wiki.dolibarr.org/index.php/Module_Web_Services_API_REST_(developer)#Adding_a_new_service) of the documentation.

In first I create with Dolibarr option “CREATE” a api file called “api\_module.class.php”. And It start working a service with the object tab you where. But It doesn’t allow to create another file for the others objects keeping this.  
Then I tried to change the name of this file to “api\_object.class.php” like the post I shared before explains.  
But when doing this after going to api rest explorer and “fetching resource list: [http://localhost/dolibarr/api/index.php/explorer/swagger.json;](http://localhost/dolibarr/api/index.php/explorer/swagger.json;) Please wait.” It gives this error “failed to parse JSON/YAML response”.  
Then I understood that only one rest service is allowed per module.  
But If Dolibarr allows to create a service individual per object. The only solution I’ve in mind is to make only one file with all the services, but I think this will be too complicated. I don’t undestand why i couldn’t use more than once.  
I’m using Dolibarr 10.0.0.6.  
Anyone know about this?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![simicar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/simicar/32/3072_2.png) [@simicar](https://www.dolibarr.org/forum/u/simicar)\
**Post date:** [February 20, 2020, 12:30pm UTC](https://www.dolibarr.org/forum/t/starting-with-multiples-services-on-rest-server/18612/2 "2020-02-20T12:30:43Z")

</div>

Hello Alex,

What you are trying to do is not so easy… I haven’t been so far in the API extension and usage yet. First of all, you should look for information on the restler website [https://restler3.luracast.com/examples/\_006\_routing/readme.html](https://restler3.luracast.com/examples/_006_routing/readme.html)  
Second, I think your first approach was the correct one. Look at the categories API how it is written and working, I think this is very similar to what you want to do.

Regards,  
Marc

---

<div class="post-metadata">

**Author:** ![Lewis-H](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/l/49beb7/32.png) [@Lewis-H](https://www.dolibarr.org/forum/u/Lewis-H)\
**Post date:** [February 20, 2020, 3:23pm UTC](https://www.dolibarr.org/forum/t/starting-with-multiples-services-on-rest-server/18612/3 "2020-02-20T15:23:48Z")

</div>

Principles of Designing RESTful APIs  
Keep it simple. Souce — Internet.  
Use nouns and NOT the verbs. A lot of developers make this mistake.  
Use of right HTTP methods.  
Use Plurals.  
Use parameters.  
Use proper HTTP codes.  
Versioning.  
Use Pagination.  
I hope this helps!  
Regards,  
lewis  
Developer
