Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add System ID to /characters/{character_id}/contracts/ #1213

Open
3 of 8 tasks
alexbaileyuk opened this issue Jun 24, 2020 · 11 comments
Open
3 of 8 tasks

Add System ID to /characters/{character_id}/contracts/ #1213

alexbaileyuk opened this issue Jun 24, 2020 · 11 comments

Comments

@alexbaileyuk
Copy link

Feature Request

When looking at contracts via the ESI, it would be useful to have the system ID included in the response similar to 'start_location_id' and 'end_location_id'. You could use 'start_system_id' or 'end_system_id'.

Using the above existing fields is cubersome and usually you're not bothered if a contract is in a specific structure. Furthermore, there is seemingly no way to translate a location ID to a system ID. For example, location ID 1031461794475. It appears to not be accepted by any of the look up endpoints.

Instead, we have to use a reference to look up the type of location it is and then go to look up the location (reference)

A different solution could be to add the location type to the location so for example 'start_location_id': 123456 becomes 'start_location': {'id': 123456, 'type': station}. Possible types could be citadel, station etc.

Use case

Anyone dealing with contracts who wants to aggregate details by system ID. For example, alliances checking that dotrines are stocked or contract seeders checking their own stock levels.

Authentication

Both solutions above use the existing contract endpoint which already has auth required.

Example return

[
  {
    "start_system_id": 12345,
    "end_system_id": 1235543,
    ...rest of contract details
  }
]

Alternatively:

[
  {
    "start_system": {
      "id": 123,
      "type": "station"
    },
    "end_system": {
      "id": 45432,
      "type": "citadel"
    },
    ...rest of contract details
  }
]

Checklist

Check all boxes that apply to this issue:

  • Feature request description is provided
  • Use case exists
  • Feature requires a new route
  • Feature adds data to existing route
  • Feature requires new auth scope
  • Feature can reuse existing scope
  • Feature does not require auth
  • Meta feature, applies to all routes
@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Jun 24, 2020

Given ESI's past nature of reducing redundant data, I'm not so sure this will be approved.

Instead, we have to use a reference to look up the type of location it is and then go to look up the location (reference)

Is this really a problem? AFAIK there can only be two "types" of origin, a structure or a station, which you can easily deduce based on the size of the ID. I.e. something like:

path = location_id > 1_000_000_000_000 ? 
  "/universe/structures/#{location_id}/") : 
  "/universe/stations/#{location_id}/")

...

I would think it's easy enough to get this data thru the {start,end}_location_id.

@alexbaileyuk
Copy link
Author

@Blacksmoke16 get what you're saying in which case how about a better way to lookup a location? Right now there is no way to translate a location ID through the ESI. It requires knowledge that cannot be found in the ESI API Spec or the docs at present which doesn't feel right.

@alexbaileyuk
Copy link
Author

Also, when you have found what you want in the ESI, you can't just do:

path = location_id > 1_000_000_000_000 ? 
  "/universe/structures/#{location_id}/") : 
  "/universe/stations/#{location_id}/")

Because one endpoint returns system_id and one returns solar_system_id :/

@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Jun 24, 2020

Right now there is no way to translate a location ID through the ESI. It requires knowledge that cannot be found in the ESI API Spec or the docs at present which doesn't feel right.

It is documented, https://docs.esi.evetech.net/docs/id_ranges.html. You also have to take the context of the endpoint you're using into consideration. In this case contracts can only ever originate from a structure or a station, so doing a simple check on the size of the location_id is easy enough.

I would also suggest/assume you're keeping a database of previously resolved locations; this would make what you want easier as you only have to resolve locations you haven't seen before.

Because one endpoint returns system_id and one returns solar_system_id :/

That is an issue on its own, see #1029. But I'm not sure I see how that fits into this discussion.

Either way, I'll leave this open for some other @esi/ecm to give their thoughts. Then we can go from there.

@lukasni
Copy link
Member

lukasni commented Jun 24, 2020

I think this is a valid request, not because of the extra requests required, but because the character may not have access to the start/end location if they are structures. Thanks to the structure deliveries system, those contracts may still be of interest, and having a way of resolving the system id in those cases would be good.

@ddouglas
Copy link
Contributor

This could be abused. If somebody gives an app access to contracts but not to structures, exposing the solar_system_id in the contract exposes where the solar system that structure exists (obviously). Using this, somebody could easily build a list of solar system <=> structures. Even if they can't resolve the structure id to figure out which type of structure it is.

@lukasni
Copy link
Member

lukasni commented Jun 24, 2020

Hm, that's a fair point. On the other hand, /markets/{region_id}/orders/ already has a similar leak for ranged orders, and that's on a public route. Hard to balance it I suppose, comes back to the more general issues with working with structures from ESI.

@ddouglas
Copy link
Contributor

Good Point, wasn't aware of that. Just wanted to point it out. Not saying this wouldn't be valuable, that is just the first thing that came to mind.

@alexbaileyuk
Copy link
Author

@Blacksmoke16 you're right I did not see that documented. Well spotted.

@ddouglas this is character contracts though. The player can see in game the system that the structure is located by opening the contract details so I fail to see a security hole here.

@lukasni I agree that being able to identify that a contract is in a structure the user has no access to is also a valid use case here. This would likely be useful to JF pilots etc.

@CarbonAlabel
Copy link
Member

Closely related to #1017.

As I commented in that issue, adding system IDs to the endpoints would be a reasonable solution, which has previously been used for the market endpoints (#450).

@Blacksmoke16
Copy link
Member

Blacksmoke16 commented Jul 5, 2020

After thinking on this more, I agree it's a good idea.

EDIT: This would actually be super helpful for a project I'm currently working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants