OPSkins / trade-opskins-api

API docs for trade.opskins.com
41 stars 19 forks source link

Unclear how to get "uid" and "token" param to use ITrade/SendOffer #35

Closed jtquant closed 6 years ago

jtquant commented 6 years ago

It's unclear how to get the "uid" and "token" param to use ITrade/SendOffer endpoint.

Based on the current documentation, the ITrade/GetTradeURL endpoint returns your trade URL data, not another user's data. This is the same for the IUser/GetProfile/v1/ endpoint as well. Neither of these end-points returns data for other users.

So how do we get a user's "uid" and "token" to initiate a send offer with the ITrade/SendOffer endpoint?

Voyager-Two commented 6 years ago

Good question, for now you can use https://github.com/OPSkins/trade-opskins-api/blob/master/ITrade/SendOfferToSteamId.md

I believe this issue can be resolved by allowing ITrade/SendOffer to accept trade_url just like: https://github.com/OPSkins/trade-opskins-api/blob/master/ICaseSite/GetKeyCount.md

Voyager-Two commented 6 years ago

You can also ask the user for their Trade URL (similar to Steam), and parse the uid & token.

https://trade.opskins.com/t/uid/token

jtquant commented 6 years ago

@QuantumLlama Got it. I like your proposed solution of allowing ITrade/SendOffer to accept trade_url. In the mean time I think we'll use the parse method until we can just pass the trade_url to the endpoint.

memiamp commented 6 years ago

When parsing the trade_url, remember that there are at least two 'valid' trade URL formats (that I have seen):

https://trade.opskins.com/t/12345/AbCdEfGh and https://trade.opskins.com/trade/userid/12345/token/AbCdEfGh

The parser we wrote in PHP handles both. Hopefully these are the only two formats available.

ha1331 commented 6 years ago

Why are there two (or more) valid trade_url formats in the first place? Are there going to be more of these formats in the future? Are these documented somewhere?

memiamp commented 6 years ago

When you send a request to the trade URL in the format https://trade.opskins.com/t/12345/AbCdEfGh, the web server returns a status code 302 and redirects you to the longer format https://trade.opskins.com/trade/userid/12345/token/AbCdEfGh.

I would presume that these are therefore the only two formats that exist currently.

It's also worth remembering that in order to be a valid URL, each of these links can (or can not) have the trailing /: https://trade.opskins.com/t/12345/AbCdEfGh, or https://trade.opskins.com/t/12345/AbCdEfGh/, or https://trade.opskins.com/trade/userid/12345/token/AbCdEfGh, or https://trade.opskins.com/trade/userid/12345/token/AbCdEfGh/