# Fetch all Alliances and Corporations to local Database and keep it up to date

**URL:** <https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086>\
**Category:** Third Party Developers\
**Tags:** esi\
**Created:** [May 23, 2018, 4:51pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086 "2018-05-23T16:51:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rtg\_Quack](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/rtg_quack/32/259589_2.png) [@Rtg\_Quack](https://forums.eveonline.com/u/Rtg_Quack)\
**Post date:** [May 23, 2018, 4:51pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/1 "2018-05-23T16:51:38Z")

</div>

I would like to implement a autosuggest field to select a corporation by ticker or name. Except for /search/?categories=corporation I had not found any method ESI offers to search for a corporation.

An (expensive) option would be to fetch all corporations on a regular base and manage a full corp database inside my application.

Does anybody have a suggestion for this?

---

<div class="post-metadata">

**Author:** ![jemmi](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/jemmi/32/74646_2.png) [@jemmi](https://forums.eveonline.com/u/jemmi)\
**Post date:** [May 23, 2018, 5:08pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/2 "2018-05-23T17:08:24Z")

</div>

They already have an in-game Corp search tool that works pretty good.

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [May 23, 2018, 5:30pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/3 "2018-05-23T17:30:14Z")

</div>

Yes but that doesn’t address his question.

You’re best bet is prob using the search endpoint and a character/time limit between lookups. Then just pass the resulting IDs thru the bulk id -\> name endpoint and display.

---

<div class="post-metadata">

**Author:** ![EveDataRules](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/evedatarules/32/52946_2.png) [@EveDataRules](https://forums.eveonline.com/u/EveDataRules)\
**Post date:** [May 23, 2018, 5:58pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/4 "2018-05-23T17:58:44Z")

</div>

You are going to want your own database for this for it to work at any decent speed for typeahead.

---

<div class="post-metadata">

**Author:** ![Rtg\_Quack](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/rtg_quack/32/259589_2.png) [@Rtg\_Quack](https://forums.eveonline.com/u/Rtg_Quack)\
**Post date:** [May 23, 2018, 6:53pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/5 "2018-05-23T18:53:20Z")

</div>

Any idea on how to fetch all corporations as well a delta (changes) after some time?

I hardly doubt to fetch.  
/alliances/  
then for each:  
/alliances/{alliance\_id}/corporations/  
then for each:  
/corporations/{corporation\_id}/

is the solution, in particular if I have to keep an eye on the API limits.

I also have been looking around for some static or 3rd party API but wasn’t successful.

---

<div class="post-metadata">

**Author:** ![Rtg\_Quack](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/rtg_quack/32/259589_2.png) [@Rtg\_Quack](https://forums.eveonline.com/u/Rtg_Quack)\
**Post date:** [May 31, 2018, 3:41pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/6 "2018-05-31T15:41:56Z")

</div>

Any suggestion on how to improve the functionality are highly welcome!

This is a quite exensive and time consuming procedure.

1. Get a list of all alliances  
`/latest/alliances/`
2. For each alliance get the detail of the alliance  
`/latest/alliances/{alliance_id}/`
3. For each alliance get get a list of all corporations (by ID)  
`/latest/alliances/{alliance_id}/corporations/`
4. For each corporation in the list of alliances get the details about a alliance  
`/latest/corporations/{coproration_id}/`

All in all the ammount of requests is reasonable. We have \> 3000 alliances and \>11000 corporations. ESI repsonds sometimes with a `502 Bad Gateway`. Because of this I have to track what has been updated and where to resume.

I assume Alliance and Corporation data is mort the less stable except the ammount of members, and more critical for my appilcation, the assignment of corporations to alliances.

Does anybody has a smart solution on how to keep a local alliance and corporation database stable?

---

<div class="post-metadata">

**Author:** ![Catherine\_Solenne](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/catherine_solenne/32/206827_2.png) [@Catherine\_Solenne](https://forums.eveonline.com/u/Catherine_Solenne)\
**Post date:** [May 31, 2018, 4:01pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/7 "2018-05-31T16:01:31Z")

</div>

Refresh locally once per day or whatever seems appropriate to you for typeahead, then hit /search/ if you get an input that you cant find.

If you use Etags the daily refresh of the local cache should be pretty light since most info will be unchanged

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://sea1.discourse-cdn.com/eveonline/user_avatar/forums.eveonline.com/blacksmoke16/32/376589_2.png) [@Blacksmoke16](https://forums.eveonline.com/u/Blacksmoke16)\
**Post date:** [May 31, 2018, 4:15pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/8 "2018-05-31T16:15:48Z")

</div>

If you only need the name of each corporation, you could replace step 4 with a bulk ID -\> Name lookup via [https://esi.evetech.net/ui/#/Universe/post\_universe\_names](https://esi.evetech.net/ui/#/Universe/post_universe_names). But if you require additional information you would have to lookup each corporation.

Also note that this will only work for corporations that are members of an alliance.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/eveonline/original/3X/4/1/41ec4921cbaca7a6f9ea556e7cc20018461eae5e.png) [@system](https://forums.eveonline.com/u/system)\
**Post date:** [August 29, 2018, 4:15pm UTC](https://forums.eveonline.com/t/fetch-all-alliances-and-corporations-to-local-database-and-keep-it-up-to-date/78086/9 "2018-08-29T16:15:54Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
