Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat
Welcome, Guest. Please login or register.
Did you miss your activation email?

August 05, 2021, 12:39:27 PM

Login with username, password and session length

Author Topic: SC4D LEX API Source-code on Github  (Read 9025 times)

0 Members and 1 Guest are viewing this topic.

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 443
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: SC4D LEX API Source-code on Github
« Reply #20 on: July 21, 2015, 04:15:17 AM »
I've fixed the comments for locked files (in v3) and added the vote retrieval functionality (in v3: http://sc4devotion.com/csxlex/api/v3/lot/1734/vote). It's a very simple endpoint, just a mapping "rating" => "number of votes". I may incorporate it in the normal /lot endpoint later.
Follow my SimCity 4 Let's play on YouTube

Offline Yild

Re: SC4D LEX API Source-code on Github
« Reply #21 on: July 22, 2015, 04:08:04 AM »
That was quick response :)

Actually it would be better if this data would be available in GET /api/<version>/search in concise=false and/or in GET /api/<version>/lot/:lotid: - ATM this require additional queries which result in server resource drain :)

In addition it would be great if search and lotinfo JSON would return additional data like: "lex category" and "lex type", "downloads count".

Comments: don't know why in v3 comments are deprecated (other than 'disqus'...), old comments are and will be still available (?), so some additional data in comments JSON would be nice: "is author", "is admin", atm I can connect comments made by author by list from GET /api/<version>/category/author... ("is admin" could be useful for locked files - where admin state reason for locking it).


Thanks
DAMN Manager download: at LEX at STEX
DAMN Manager support thread: at SC4Dev

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 443
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: SC4D LEX API Source-code on Github
« Reply #22 on: July 22, 2015, 04:35:39 AM »
I will add the voting and comments to concise=false for lot and search soon.

Download count is already returned by lot_info & search (the "num_downloads" property). However, lex category and lex type are not. It makes sense to add that, however, so I will.

Comments are indeed not deprecated anymore. The experiment with disqus was not well-received and scratched. I believe the comments JSON already includes is_author: true/false and is_admin: true/false, both in v1, v2 and v3. See http://sc4devotion.com/csxlex/api/v1/lot/1700/comment for example.
Follow my SimCity 4 Let's play on YouTube

Offline Yild

Re: SC4D LEX API Source-code on Github
« Reply #23 on: July 22, 2015, 05:16:59 AM »
I believe the comments JSON already includes is_author: true/false and is_admin: true/false, both in v1, v2 and v3. See http://sc4devotion.com/csxlex/api/v1/lot/1700/comment for example.

ups... my mistake, didn't even check if data is there 'already'  ::)
DAMN Manager download: at LEX at STEX
DAMN Manager support thread: at SC4Dev

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 443
  • Reputation: 47
  • CL:
    The Go-To Guy!!
SC4D LEX API Source-code on Github - v4 work started
« Reply #24 on: July 23, 2015, 02:19:06 PM »
I've started work on a v4 of the API, that will incorporate your suggestions and also unify the interface (especially the /search and /lot/<lotid> results will be more uniform).

Dependencies can be requested with ?dependencies, comments with ?comments, votes with ?votes and last_downloaded with ?user. Also date and datetime fields will now properly follow the ISO-8601 standard (I believe).

So for example:

http://sc4devotion.com/csxlex/api/v4/lot/3146?comments&votes&dependencies&user
(requesting Lot 3146 with comments, votes, dependencies and user info)

Will return:
Code: [Select]
{
    "id": 3146,
    "name": "SCILT, BSC Diagonal Tile Version with Sidewalk Mod",
    "version": "1.0",
    "num_downloads": 47,
    "author": "c.p.",
    "is_exclusive": false,
    "description": " \\\r\\\n\\\t\\\r\\\n\\\t\\\t Sidewalk Compatible Interchangeable Lot Textures. This is a collection of lot textures intended to match the texture of your sidewalk mod. Note that for this version, the sidewalk mod is included, meaning the sidewalk textures in your game will change to this texture. The lot textures should be useful on lots where the sidewalk texture needs to be extended onto the lot, or for paths, plazas, patios, etc.  \\\r\\\n\\\t\\\r\\\n\\\t \\\r\\\n\\\t\\\r\\\n\\\t\\\t The different versions are interchangeable, meaning if you remove one version from your plugins and replace it with another, the game will show the new SCILT textures on your lots in place of the old SCILT textures. \\\r\\\n\\\t\\\r\\\n\\\t \\\r\\\n\\\t\\\r\\\n\\\t\\\t The texture is from BSC Textures Vol 02. \\\r\\\n\\\t\\\r\\\n",
    "images": {
        "primary": "http:\\/\\/sc4devotion.com\\/csxlex\\/images\\/beximg\\/LEX_SCILT_BSCDiagonalTile.jpg"
    },
    "link": "http:\\/\\/sc4devotion.com\\/csxlex\\/lex_filedesc.php?lotGET=3146",
    "is_certified": true,
    "is_active": true,
    "upload_date": "2014-12-12T00:00:00-0600",
    "update_date": null,
    "filesize": "733.68 KB",
    "comments": [
        {
            "id": 36889,
            "user": "caspervg",
            "text": "Thanks a lot for this wonderful creation!",
            "date": "2015-07-23T00:00:00-0500",
            "by_author": false,
            "by_admin": true
        }
    ],
    "votes": {
        "1": 2,
        "2": 0,
        "3": 0
    },
    "dependencies": {
        "status": "ok",
        "count": 1,
        "list": [
            {
                "internal": true,
                "id": 638,
                "name": "BSC Textures Vol 02",
                "status": {
                    "ok": true,
                    "deleted": false,
                    "superceded": false,
                    "superceded_by": -1,
                    "locked": false
                }
            }
        ]
    },
    "last_downloaded": "2015-07-23T14:25:21-0500"
}
(http://caspervg.net/codedrop/view.php?a3d2a560b1d7796f9b476a97eb30ce0b)

« Last Edit: July 23, 2015, 02:26:03 PM by CasperVg »
Follow my SimCity 4 Let's play on YouTube

Offline Yild

Re: SC4D LEX API Source-code on Github
« Reply #25 on: July 29, 2015, 12:59:39 PM »
any ETA when v4 branch will become master ? :)


btw

http://sc4devotion.com/csxlex/api/v1/ (v1-v4) there is an info pointing to http://sc4devotion.com/forums/index.php?topic=16074.0 but this URL gives me "The topic or board you are looking for appears to be either missing or off limits to you." error
DAMN Manager download: at LEX at STEX
DAMN Manager support thread: at SC4Dev

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 443
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: SC4D LEX API Source-code on Github
« Reply #26 on: July 29, 2015, 01:53:34 PM »
Heh, that's actually a very old thread, documenting my first iteration of the LEX search api ( located at http://www.sc4devotion.com/csxlex/lex_api_search.php ). I'll remove the link to it since it is a private thread. Everything you need to know is in https://github.com/caspervg/SC4Devotion-LEX-API/blob/master/documentation/Search.md

I'm hoping for an official v4 release this weekend. The main "issue" right now is updating the documentation.
Follow my SimCity 4 Let's play on YouTube

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2890
  • Total likes: 443
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: SC4D LEX API Source-code on Github
« Reply #27 on: August 02, 2015, 11:27:08 AM »
LEX API v4 is now officially released and available at http://sc4devotion.com/csxlex/api/v4. Updated (hopefully complete) documentation as available in the Github repository
Follow my SimCity 4 Let's play on YouTube