-1

I want to get user information using coinbase api. For that one I have found the coinbase curl usl which will provide me the user information.

Curl Url :

https://api.coinbase.com/v2/users/:user_id

I have already registered my account in coinbase website, also check in all option provided in website but no where I found my user_id.

Problem is How do I get my user_id of my coinbase account..?

Codebrekers
  • 754
  • 1
  • 11
  • 29
  • What does codeigniter have to do with that url ? . – Arsh Singh Jul 19 '16 at 09:20
  • He's probably using that framework for development. At least he indicated? Geez Arsh you have to ruin every damn party? Chill for a sec before turning into codepolice. – PockeTiger Jul 19 '16 at 09:24
  • @ArshSingh : Using that URL i'll get information of that user. – Codebrekers Jul 19 '16 at 09:24
  • @PockeTiger did you even read my comment carefully ? ,, i asked him, what does codeingiter have to do with url , i wanted the information about , how he is using codeingiter in it , if yes then he need to post the controller code , simple ? – Arsh Singh Jul 19 '16 at 09:27
  • @Codebrekers , have you tried some code ? , if yes please do post it inside your question , and also if you haven't used yet , make it clear inside the question about what you tried till now , it will help others to understand better your situation , else everyone is going to ask you to post code. – Arsh Singh Jul 19 '16 at 09:28
  • Guys this is curl url which I have enter in postman and get information of that user basically I am using coinbase api for my webservices – Codebrekers Jul 19 '16 at 09:33
  • @Codebrekers check on here https://www.coinbase.com/settings – Abdulla Nilam Jul 19 '16 at 09:34
  • @Codebrekers , we are not clear about the code you have tried till now , and the way you are trying to fetch the information , as the api requires token for accessing the data and the user_id is random hashed code which you get in the api , but you will not get that , until you don't send the token with headers in curl. you get a json array with user_id and other informations inside it. – Arsh Singh Jul 19 '16 at 09:35
  • @Spartan : Thanks for suggestion but I have allready check in that but no where they mentioned user id. – Codebrekers Jul 19 '16 at 09:35

2 Answers2

0

You can ask the API for the current User informations with a https://api.coinbase.com/v2/user request. This will return any publicly available information regarding the current user.

Example response:

{
  "data": {
    "id": "9da7a204-544e-5fd1-9a12-61176c5d4cd8",
    "name": "User One",
    "username": "user1",
    "profile_location": null,
    "profile_bio": null,
    "profile_url": "https://coinbase.com/user1",
    "avatar_url": "https://images.coinbase.com/avatar?h=vR%2FY8igBoPwuwGren5JMwvDNGpURAY%2F0nRIOgH%2FY2Qh%2BQ6nomR3qusA%2Bh6o2%0Af9rH&s=128",
    "resource": "user",
    "resource_path": "/v2/user"
  }
}

As you can see it contains the user_id you are looking for under the id field. This should be suffiecient to acquire your user info.

PockeTiger
  • 1,010
  • 7
  • 8
  • Tiger : If I am simply call "https://api.coinbase.com/v2/user" in postman it'll give me error like invalid tocken like "errors": [ { "id": "invalid_token", "message": "The access token is invalid" } – Codebrekers Jul 19 '16 at 09:58
  • Your access token is expired then. You should Authenticate and refresh it. PS.: You can find a description about how to acquire a valid access and refresh token on [this link.](https://developers.coinbase.com/docs/wallet/coinbase-connect/integrating) – PockeTiger Jul 19 '16 at 10:01
0

You can get in, in Python using de CoinBase API for Python, for instance:

#LIBRERIAS:
from coinbase.wallet.client import Client

# conexion a CoinBase
client = Client('xxxxxxxxxx', 'xxxxxxxxxxxxxx')

user = client.get_current_user()

print("user items: "+str(user)+'\n')