Question API or a way to get user's purchased content

Discussion in 'Community Support' started by Stefan Mizzi, Mar 3, 2019.

  1. Stefan Mizzi

    Stefan Mizzi Well-Known Member

    Joined:
    Feb 6, 2015
    Ratings:
    +597 / 0
    Hi @Sector3

    Before a user joins one of Justrace's servers, I would like to check if he/she has the content required. Is there a way I can call some API or read this date from somewhere please?

    Thanks!

    upload_2019-3-3_9-31-42.png
     
  2. Scout

    Scout Well-Known Member Beta tester

    Joined:
    Sep 3, 2018
    Ratings:
    +182 / 0
    You can use http://game.raceroom.com/users/Scout_ire/purchases?json - just replace the username with the users name or portal ID.

    The purchased content should appears as an array under context.c in the JSON returned.

    context.c.purchased_content[0] // cars
    context.c.purchased_content[1] // liveries
    context.c.purchased_content[2] // tracks

    Looking at the format of how the data is structured, it might be easiest to stringify the JSON and then check to see if a vehicle ID is contained in that string, rather than doing looping through each item checking if there is an ID match.

    Hope it helps.
     
    • Like Like x 1
  3. ChatCureuil

    ChatCureuil Well-Known Member

    Joined:
    Feb 10, 2017
    Ratings:
    +291 / 0
    • Like Like x 2
  4. Stefan Mizzi

    Stefan Mizzi Well-Known Member

    Joined:
    Feb 6, 2015
    Ratings:
    +597 / 0
    Thank you guys, much appreciated :) I had already tried the purchased content you mentioned but I always get the Owned flag = False unless I login...

    upload_2019-3-11_6-30-6.png
     
    Last edited: Mar 10, 2019
  5. Stefan Mizzi

    Stefan Mizzi Well-Known Member

    Joined:
    Feb 6, 2015
    Ratings:
    +597 / 0
    I think I have figured it out...json data/structure is a bit confusing. So for McLaren GT3 I have 1 skin and this would be it...

    upload_2019-3-11_7-39-15.png