Jump to content

Schaken

Members
  • Posts

    182
  • Joined

  • Last visited

 Content Type 

Downloads

Release Notes

IPS4 Guides

IPS4 Developer Documentation

Invision Community Blog

Development Blog

Deprecation Tracker

Providers Directory

Forums

Events

Store

Gallery

Everything posted by Schaken

  1. Yes. Which is what I am looking for. I sent the files using Base64Encoded. I sent it in Binary form, i sent it as Bytes, I sent it as JSON. I can not find anything that says "To upload files, please use XXXX". So I'm pretty bent on the fact the API is broke when uploading, since I tried to upload in every way possible. Even if there was an example wrote in PHP, I could easily figure out what is needed to upload something, but the only thing I can get to upload is just strings, which is the forum.
  2. This is what is returned to me AFTER I upload, I need to know what TO upload. I Have the file on my computer. Now how do I get it from point A to point B. I can upload it, and my app will even show me the entire file is uploaded, I am using the correct key. I can upload it as bytes[] I can upload it as Base64Encoded, I can do it any way you tell me to, but nowhere does it say how to upload it. I am out of ideas on how to upload any file, because no matter what I do, I cant upload anything other than strings, which is for the Forums app.
  3. I seem to be missing it. can you screenshot or copy and paste where it says what format to upload the files in. I looked 3 times today thinking I was blind, but I still do not see.
  4. Here is alot of my issues: I always go off the Documentation. But sending an "Object" is just not clear. For example, when posting an image (ALSO cant get to work) it says to upload as 64 bit encoded. So, it is at least giving me a hint of what form to send the file in. but here we have "Object". So, I tried sending it as "Bytes" as that would make the most sense, but this don't work. So, I reverted to the idea of "64bitEncoded" and that also failed. So, I tried many different forms and mixtures of each. I used ChatGTP to help me which sent me about 6 different ways, all failed. I googled ways, no one even uses Invision Community according to google, because there is no information outside of here. At this point if I cannot solve this API issue, I'm going to start the process of using a different framework. I have another website as well where I went with Xenforo, and I can upload to its API with no issues. Considering that I can upload files and images to pretty much any API that I can find except here, I am in the thought that the API is broke, its locked only accept internal calls, or there is just something really weird about the form to send it in that only Invision is using and isn't documented.
  5. I also used ChatGPT, it fed me about 4 different ideas, none of which worked either, I fed it my code and it made a few different ideas and none of those worked. I debugged a bunch and my file path to my file is correct, the file while debugging showed my file is 2MB in size, and all my parameters are correct. I just don't understand because I can upload files to GoFile, Microsoft Onedrive, and even Google. I Can make posts to the forums here which has to be in a string, so I know I am sending everything right, but no matter what I do I cannot send any files thru API with invision. this is becoming a really big problem as I am growing, I really need that API figured out. I believe someone (Was it you @Stuart Silvester ?) that was working on a new API system, or an alternative one that was mentioned in a different forum. I would like to try that one if it is possible and ready. Because I'm pretty certain that either this API setup only works for PHP or is just not working in some areas. I can "GET" any and all information without any issues. It is the "POST" that is the issue. I also have another website on my server, I use Xenforo, and I can post to it just fine with files. I really enjoy invision, but I'm lost how to make this work and sadly this system seems to be moving in a direction I am not wanting to go in, (Cloud and almost forum alone) and that is an issue. The forum system here is 100% unbeatable and that's wonderful, but forums are not the main focus on my community. I host a video game community so desktop apps are the main focus, making games able to upload and download directly from my website is becoming a requirement and I cannot mate that happen, and so far I haven't found any professional who can either. I may add I have made many applications now that my community used, strictly based off of the API. this being said nothing can post anything except a string to the forum, but they get all the information in the world.
  6. Tested with same result. private IEnumerator UploadMod(string A, string B) { Debug.Log("A: "+A+"; B: "+B); Byte[] bytes = File.ReadAllBytes(A); String file = Convert.ToBase64String(bytes); var url = "https://MySite.com/api/downloads/files"; WWWForm content = new WWWForm(); content.AddField("category", "390"); content.AddField("files", file); content.AddField("author", "3"); content.AddField("title", ModName.text); content.AddField("description", Description.text); content.AddField("version", Version.text); UnityWebRequest uwr = UnityWebRequest.Post(url, content); uwr.SetRequestHeader("Authorization", "Bearer " + BearerID); yield return uwr.SendWebRequest(); if (uwr.result == UnityWebRequest.Result.ConnectionError) { Debug.Log("Error While Sending for User info: " + uwr.error); } else { string result = uwr.downloadHandler.text; string FullTXT = result.Replace(@"\", string.Empty); Debug.Log(FullTXT); } uwr.Dispose(); } Tested, same result. private IEnumerator UploadMod(string A, string B) { Debug.Log("A: "+A+"; B: "+B); string[] path = new string[1]; path[0] = A; var url = "https://MySite.com/api/downloads/files"; UnityWebRequest[] files = new UnityWebRequest[path.Length]; WWWForm content = new WWWForm(); for (int i = 0; i < files.Length; i++) { files[i] = UnityWebRequest.Get(path[i]); yield return files[i].SendWebRequest(); content.AddBinaryData("files", files[i].downloadHandler.data, Path.GetFileName(path[i])); } content.AddBinaryData("files", file, B, "application/zip"); content.AddField("category", "390"); content.AddField("author", "3"); content.AddField("title", ModName.text); content.AddField("description", Description.text); content.AddField("version", Version.text); UnityWebRequest uwr = UnityWebRequest.Post(url, content); uwr.SetRequestHeader("Authorization", "Bearer " + BearerID); yield return uwr.SendWebRequest(); if (uwr.result == UnityWebRequest.Result.ConnectionError) { Debug.Log("Error While Sending for User info: " + uwr.error); } else { string result = uwr.downloadHandler.text; string FullTXT = result.Replace(@"\", string.Empty); Debug.Log(FullTXT); } uwr.Dispose(); }
  7. I come again with struggles using the API. I can use the API to post Topics and a few other things, but when it comes to POSTing... I get pretty aggravated because on one app we have to send data one way, but in another app, we have to send the exact same file in a different form, this makes things VERY complicated! I apologize, as I usually wait until I exhausted all my resources before coming here and asking for help, and by this point I realize im just angry, and I try not to show it, but I still vent a little. The issue... So I am making an App for my website, which hosts video games and Mods for games. I made a "Uploader" tool that can be installed in a game so people can download from my site (Done!) Browse content on my site (Done) and now it is time for uploading to my site (error). I am trying to do the basic and upload a file to the "Downloads" app using the API. I am using C# as this is a desktop app, and I am using unity. My Code: private IEnumerator UploadMod(string A, string B) { var url = "https://MySite.com/api/downloads/files"; //<-- Not my actual address var bytes = System.IO.File.ReadAllBytes(A); WWWForm content = new WWWForm(); content.AddBinaryData("files", bytes, B, "application/zip"); content.AddField("category", "390"); content.AddField("author", "3"); content.AddField("title", ModName.text); content.AddField("description", Description.text); content.AddField("version", Version.text); UnityWebRequest uwr = UnityWebRequest.Post(url, content); uwr.SetRequestHeader("Authorization", "Bearer " + BearerID); yield return uwr.SendWebRequest(); if (uwr.result == UnityWebRequest.Result.ConnectionError) { Debug.Log("Error While Uploading Mod: " + uwr.error); } else { string result = uwr.downloadHandler.text; string FullTXT = result.Replace(@"\", string.Empty); Debug.Log(FullTXT); } } The error I get is of course: { "errorCode": "1L296/B", "errorMessage": "NO_FILES" } The only thing I can think of is maybe I have to send files in a different format? Anyone have any clue? Here is the source for my madness: Unity - Scripting API: WWWForm.AddBinaryData (unity3d.com)
  8. I personally use https://rss.app/ and it does a very good job. you can have a bunch of different RSS setups for free and it has a RSS builder. I have used it for about 4 years now. To add to that I made an app that web crawls the RSS site and grabs the content more to my needs and rebuilds my forum post that way I want AFTER the RSS has been initially grabbed. RSS is REALLY cool, but using API's and Webhooks are way better when you are able to use them.
  9. The PHP is too different, this plugin just wont work anymore.
  10. @Daniel F you are awesome. As you know, I try real hard to make things look pretty, it tends to sell better. When im getting API's for forum categories, I would love to be able to grab the category image, and/or Icon. Same with gallery. People usually dont read as often as they just look for pictures, and the Invision system has functionality for this, but not in the API. For example, I would like to grab images from here. I can simply make them in my app, but if this ever changes on my site, I will have to update my app. And of course, as our earlier conversation, maybe a different way to upload images to the gallery. most other API I can upload as objects, which I can do this fine. but in the gallery for some reason I am really struggling to make it an encoded base64 image. and one that I almost forgot about... I would love for a way to upload images in topics. for example how I uploaded those images just now, I would love to do that with the API, granted I could upload to a 3rd party and just enter HTML to make it happen... but then I have to rely on 3rd party services and they delete images pretty fast and anyone reviewing topics will see tons of broken images.
  11. This is great for some things, but it is not tied in to half of the apps yet. If this is still under development and they are still adding, then this has some really good potential.
  12. Thank you for this. its by the same guy who i usually deal with and offers me assistance. my guess is he is tired of dealing with me and making fixes and updates himself. lol. he is a great guy.
  13. I would love to see some improvements of the API system. I don't think you all have expanded or touched it in years. it would be awesome to see it expanded on. I am a program developer working with mostly C# and I end up having to make a web crawler to get common information pretty often.
  14. Doing some google search.. $content = file_get_contents( $img); // encode it $content = base64_encode( $content); this part you entered, is the same as this in C#: StreamReader sr = new StreamReader(filePath); string sContentsa = sr.ReadToEnd(); sr.Close(); and public static string EncodeTo64(string toEncode) { byte[] toEncodeAsBytes = Encoding.ASCII.GetBytes(toEncode); return Convert.ToBase64String(toEncodeAsBytes); } So I tried this.. StreamReader sr = new StreamReader(filePath); string sContentsa = sr.ReadToEnd(); sr.Close(); Dictionary<string, string> content = new Dictionary<string, string>(); content.Add("category", "27"); content.Add("image", EncodeTo64(sContentsa)); content.Add("caption", ImageTitle.text); content.Add("filename", ImageTitle.text); content.Add("description", ImageDescription.text); using (UnityWebRequest www = UnityWebRequest.Post("https://XXXXXXXXXXX.com/api/gallery/images", content)) { www.SetRequestHeader("Authorization", "Bearer " + OAH.BearerID); yield return www.SendWebRequest(); if (www.result == UnityWebRequest.Result.ConnectionError) { Debug.Log("Error While Sending TEST: " + www.error); } else { string result = www.downloadHandler.text; string FullTXT = System.Text.RegularExpressions.Regex.Unescape(result); Debug.Log("TEST: " + FullTXT); } } public static string EncodeTo64(string toEncode) { byte[] toEncodeAsBytes = Encoding.ASCII.GetBytes(toEncode); return Convert.ToBase64String(toEncodeAsBytes); } And goofy enough I still got the exact same result. Do you think there may be a setting that I have set wrong in my ACP? the only thing I get in my ACP is this: I am starting to think maybe the code is right, but maybe I have something in my ACP set to block it on accident.
  15. mine is set up so only admin and moderators only can use it.
  16. This is actually how I use it. it does everyone at once, on mine it takes about 10 minutes to go thru all 150K members though. Does not show to guests.
  17. I think a deal has to be made between the two developers honestly. Im not sure if management gets involved. I know if Adriano got it, this would have tons of options to tie into all his other stuff, it would be simplified and easier to work with and kept up. he tends to go thru everything with a fine-tooth comb and makes everything better. He had a plugin that had an issue once. I simply mentioned it to him, and he fixed it, improved it, and optimized it probably within just a few minutes, lol. Actually, @Adriano Faria has made an add-on for me for this, so users could upload screenshots of their experience to a certain tab, to show others. My community loves this and uses it alot. so, he is a little familiar with the structure already.
  18. I believe this would actually work great for the downloads app. For everything else it just wants the raw file I believe, but for some reason the gallery app wants images in 64 base.
  19. Nice idea, but this gave me a "No_Image" and I have got this alot lately with my attempts last night. Seems "No_Image" is returned when the image is not readable, which tells me I'm breaking the image down wrong. Since the API says it needs to be "Encoded Base64" I just assume I need to use Convert.ToBase64String() but I think my issue is before this, or maybe a part of this. When entering text I often find myself having to use System.Text.RegularExpressions.Regex.Unescape() to make it URL friendly. I believe there must be some combo that I need to do here between them but I can't seem to crack it.
  20. Thank you for double checking. now I can focus without doubt its on my end. sometimes I just have to verify all my possibilities and mark them all off 1 by 1 so i can find the exact problem, and work on that. I know C# isn't exactly what this community uses, but its where I am at and we all have to learn and start somewhere. this is my journey and I appreciate you all giving me a hand. I WILL master this, and I will post my work so anyone who may also have the issue, will find the answer.
  21. I will always recommend @Adriano Faria for any custom work and fixing stuff. He is within the top 3 (Possibly best?) here and loves to have the work.
  22. The person who did it for me asked me to not mention him, he didnt want to get in trouble. I will PM you.
  23. I still have not got this to work. Can anyone verify that the uploading for API actually works? I want to verify it is not a bug in Invision.
  24. it's been 6 months, He either can't or won't. I gave up and had someone else update it for me.
  25. Im at a loss. I spent a full day on this, scouring the internet for any ideas and trying mixes of all variants or every sort, I am starting to believe something is just broken between point A and B. Is there a way someone can test this even if it is in just PHP? even on their own server... I just need to know its not something broke. this has to work at some point, one of the variants I tried should work. here is what I have and with all the variants marked out as i would copy and paste back and forth with other ideas. IEnumerator PostTopicPostsA() { //byte[] imageArray = System.IO.File.ReadAllBytes(FileDir); string A = @"data:image/png;base64," + Convert.ToBase64String(File.ReadAllBytes(FileDir)).TrimEnd('=').Replace('+', '-').Replace('/', '_');//Convert.ToBase64String(imageArray);//; //A = System.Text.RegularExpressions.Regex.Unescape(A); Debug.Log("Image string: "+A); Debug.Log("Imape Path: "+FileDir); Dictionary<string, string> content = new Dictionary<string, string>(); content.Add("category", "27"); content.Add("image", A);//ImageString); content.Add("caption", ImageTitle.text); // Filename? content.Add("filename", ImageTitle.text); // Real title. content.Add("description", ImageDescription.text); // Description. UnityWebRequest www = UnityWebRequest.Post("https://schaken-mods.com/api/gallery/images", content); www.SetRequestHeader("Authorization", "Bearer " + OAH.BearerID); yield return www.SendWebRequest(); if (www.result == UnityWebRequest.Result.ConnectionError) { Debug.Log("Error While Sending TEST: " + www.error); } else { string result = www.downloadHandler.text; string FullTXT = System.Text.RegularExpressions.Regex.Unescape(result); Debug.Log("TEST: " + FullTXT); } } I just keep getting "No image" and when i use the "@"data:image/png;base64," part, I get an EXO error same as the one I posted above.
×
×
  • Create New...