• Welcome to SC4 Devotion Forum Archives.

SC4D LEX API Source-code on Github

Started by CasperVg, June 13, 2014, 09:32:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

CasperVg

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

Yild

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

CasperVg

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

Yild

Quote from: CasperVg on July 22, 2015, 02:35:39 AMI 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

CasperVg

#24
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:

{
    "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)

Follow my SimCity 4 Let's play on YouTube

Yild

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

CasperVg

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

CasperVg

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