#Hey @Iluviel , sorry for the delay for

1 messages · Page 1 of 1 (latest)

opaque umbra
#

Hi @fluid gorge, sounds like an interesting project! So, we're slowly in the process of deprecating our /v1 api, that uses API keys in favour of our graphql API, which uses OAuth and tokens. Yes, each user would have to authenticate by giving your app access to their account.

The only thing I would mention is that users can only download files through the API if they are premium - otherwise they would have to go through the site to download the files.

From a technical perspective, there are a couple of things you will need to do this and I'd be happy to help on our end:

Let me know if you need anything 🙂

fluid gorge
# opaque umbra Hi <@163794979074867201>, sounds like an interesting project! So, we're slowly i...

Thanks you so much for the help here @opaque umbra , exciting stuff. The application is currently the ialr_launcher.exe built with Unity6, https://www.nexusmods.com/dyinglight2/mods/46

The name of the Project is going to be: Unofficial Dev Tools for DI/DL

I'll review the documentation and see if I can set up a simple test application that I will share that will attempt the refresh flow and OAuth, should make it easier to see and work together to establish. Thank you again, I'll have some updates soon

fluid gorge
#

Working on the application now, @opaque umbra , I've updated the above message to include the project name:
Unofficial Dev Tools for DI/DL

I'll stand by for the Oauth key and give it a shot, thank you, let me know if I can provide anything more

fluid gorge
#

Just wanted to share an update. Using the Nexus Mod Manager API code I was able to login and pull data from the server it looks like:

#

I'm not able to attach an image, but here's the logs:
Started API key authentication
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:LoginWithApiKey () (at Assets/Scripts/Nexus/NexusUIDebug.cs:475)
NexusMods.NexusUIDebug:DrawWindow (int) (at Assets/Scripts/Nexus/NexusUIDebug.cs:227)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

API key validated for user: DocOnHoliday
UnityEngine.Debug:Log (object)
NexusMods.NexusModsManager/<>c__DisplayClass30_0/<<ValidateApiKeyCoroutine>b__0>d:MoveNext () (at Assets/Scripts/Nexus/NexusModsManager.cs:483)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

Authentication complete - Success: True, Message: Logged in as DocOnHoliday
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:OnAuthenticationComplete (bool,string) (at Assets/Scripts/Nexus/NexusUIDebug.cs:519)
UnityEngine.Events.UnityEvent`2<bool, string>:Invoke (bool,string)
NexusMods.NexusModsManager/<>c__DisplayClass30_0/<<ValidateApiKeyCoroutine>b__0>d:MoveNext () (at Assets/Scripts/Nexus/NexusModsManager.cs:484)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

Getting game info for: skyrim
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:GetGameInfo () (at Assets/Scripts/Nexus/NexusUIDebug.cs:573)
NexusMods.NexusUIDebug:DrawWindow (int) (at Assets/Scripts/Nexus/NexusUIDebug.cs:313)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

Retrieved game info for: Skyrim
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:<GetGameInfo>b__52_0 (NexusMods.GameInfo,string) (at Assets/Scripts/Nexus/NexusUIDebug.cs:584)
NexusMods.NexusModsManager/<GetGameInfoCoroutine>d__31:MoveNext () (at Assets/Scripts/Nexus/NexusModsManager.cs:562)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

Getting mod info for: skyrim/3863
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:GetModInfo () (at Assets/Scripts/Nexus/NexusUIDebug.cs:645)
NexusMods.NexusUIDebug:DrawWindow (int) (at Assets/Scripts/Nexus/NexusUIDebug.cs:346)
UnityEngine.GUI:CallWindowDelegate (UnityEngine.GUI/WindowFunction,int,int,UnityEngine.GUISkin,int,single,single,UnityEngine.GUIStyle)

Retrieved mod info for: SkyUI
UnityEngine.Debug:Log (object)
NexusMods.NexusUIDebug:<GetModInfo>b__54_0 (NexusMods.ModInfo,string) (at Assets/Scripts/Nexus/NexusUIDebug.cs:667)
NexusMods.NexusModsManager/<GetModInfoCoroutine>d__36:MoveNext () (at Assets/Scripts/Nexus/NexusModsManager.cs:762)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)

#

it's able to get the UserID, username, role, and avatar link 🙂 and then get mod data by the id

#

so far it looks like I'm not able to connect to the categories using the current docs:
Failed to get categories: NotFound - {"status":404,"error":"Not Found"}

but I am able to get the Mod Info through the Mod IDs:
`[Serializable]
public class ValidateResponse
{
public ulong user_id;
public string key;
public string name;
public bool is_premium;
public bool is_supporter;
public string email;
public string profile_url;
}

[Serializable]
public enum UserRole
{
Free,
Supporter,
Premium
}

[Serializable]
public class UserInfo
{
public string UserId;
public string Name;
public UserRole UserRole;
public string AvatarUrl;
}

[Serializable]
public class OAuthUserInfoResponse
{
public string sub;
public string name;
public string avatar;
public string[] membership_roles;
}

[Serializable]
public class GameInfo
{
public int id;
public string name;
public string domain_name;
public string forum_url;
public string nexusmods_url;
public string genre;
public string file_count;
public string downloads;
public string approved_date;
public string mods_count;
}

[Serializable]
public class ModCategory
{
public int category_id;
public string name;
public object parent_category;
}

[Serializable]
public class CategoryResponse
{
public ModCategory[] categories;
}

[Serializable]
public class CategoryInfo
{
public string Name;
public string ParentCategory;
public int Order;
}

[Serializable]
public class ModsResponse
{
public ModInfo[] mods;
}

[Serializable]
public class ModInfo
{
public int mod_id;
public string name;
public string summary;
public string description;
public string version;
public string author;
public string uploaded_by;
public string uploaded_users_profile_url;
public string created_time;
public string updated_time;
public ModEndorsement endorsement;
public ModImage[] images;
public ModFile[] files;
}

[Serializable]
public class ModEndorsement
{
public string endorse_status;
public int unique_downloads;
public int total_downloads;
public int unique_endorsements;
}

[Serializable]
public class ModImage
{
public string url;
public string filename;
public bool main;
}

[Serializable]
public class ModFile
{
public int file_id;
public string name;
public string version;
public string category_name;
public string file_size;
public string file_name;
public string uploaded_time;
}

[Serializable]
public class DownloadLinksResponse
{
public DownloadLink[] links;
}

[Serializable]
public class DownloadLink
{
public string name;
public string short_name;
public string URI;
}`

#

So far it looks like downloading the files and getting the categories are failing but I'll get more debug logs to share, probably something I missed

fluid gorge
#

Hey @opaque umbra , I do have a question. When attempting to build out a mod list for each game, I'm getting the error that the game doesn't exist on the server. It works for a single query but when trying to grab all of the mods available and build a pagination nothing I've tried is working:

Game ID 'dyinglight2' not found for mods listing.
https://api.nexusmods.com/v1/games/dyinglight2/mods?page=1&page_size=20&sort=endorsements

Failed to get mods list for dyinglight2: Game not found. Check if 'dyinglight2' is valid.
Failed to get mods list: Could not find game 'dyinglight2' on Nexus Mods. Please check the game ID or try another game.

The same thing happens when trying to get categories:
Getting categories for: dyinglight
Making request to: https://api.nexusmods.com/v1/games/dyinglight/categories.json
Response status: NotFound
Response content: {"status":404,"error":"Not Found"}
Game ID 'dyinglight' not found. Make sure the game domain name is correct.
Failed to get categories: Game not found. Check if 'dyinglight' is a valid game domain name.

Is there a document I can reference that has more information on how to request the information by game and to return the categories and modlist?

The only thing left after that is that when attempting to download the codes not currently pulling the ID path from the files:
Failed to get download links: NotFound - {"code":404,"message":"No File found for mod: 128"}

Is there a good resource for building the ID for each file?

Thanks again for your help! I really appreciate it

opaque umbra
#

Sorry for the delay - We actually don't really maintain the old API E.g. https://api.nexusmods.com/v1/... I would recommend you utilise the newer graphql API if possible:

https://graphql.nexusmods.com/

This can be accessed by performing a POST to https://api.nexusmods.com/v2/graphql - with your access token etc.

I will take a look a the categories stuff to see why that's not working, or if it's even expected to work anymore 😂

fluid gorge
# opaque umbra Sorry for the delay - We actually don't really maintain the old API E.g. https:/...

hey @opaque umbra , no worries! I understand you guys are busy, I just appreciate the support here. Ok let me try to see what I can do with graphql in Unity and see if that fixes some of the issues. Do you know if I'm able to use a browser or another software to login to the server through the api and browse the directory? Probably would help me debug a lot of the call issues when trying to fetch the data from different files, images, totals, etc

fluid gorge
#

Any issue with my using another API key for testing? I was previously just using the key to attempt to get a response from the server while waiting for the API key provided for the project