Jump to content

Global Database / API


Recommended Posts

I've spent a few days writing an API that could be used to globally track peds, arrest reports, accident reports, traffic tickets, etc. I spent a lot of time around the experience in using the API and there is a strictly controlled schema defining the request/response object types.

Before I put it away in the closet as an "Ok, I did it" project, I wanted to see if this was something that developers would like to use in their plugins/callouts. If thats the case, I'll publish the server publicly and provide more details.

Current Features

  • Officer Login/Logout
  • Officer stats
    • number of arrests
    • number of reports
    • number of tickets
    • total time logged in
  • Create/List/View Reports
    • Traffic Ticket
    • Arrest Reports
    • Incident Reports
    • Ped Tickets

In terms of integration with plugins, if there was interest I would write a C# library which could be included in the developers plugin. There would be helpful wrappers to the HTTP calls.. something like GlobalDB.find(firstName, lastName, dob), GlobalDB.login(officerUsername/id)

Currently the API returns JSON, but I'm considering adding XML support (Since .NET loves XML so much)

I'm also very open to discussion, feature requests and collaboration (API server is a node.js HAPI server)

Below is a request to the API to create a report

POST /api/report/arrest

Request body

{
  "createdAt": "2016-06-04",
  "updatedAt": "2016-06-04",
  "officer": "c67e3855-442d-49fd-95b2-7f01201a9218",
  "type": "ARREST",
  "location": {
    "street": "Fake Street",
    "city": "Sandy Shores"
 },
  "ped": {
    "firstName": "John",
    "lastName": "Doe",
    "dob": "08/08/1988",
    "gender": "M"
  },
  "statement": "Individual was traveling at excess speeds and failed to yield. A high speed persuit begun",
  "charges": [
    {
      "isFelony": true,
      "title": "Grand Theft",
      "description": "Stolen vehicle 132ABC"
    },
    {
      "isFelony": true,
      "title": "Possession of controlled substance",
      "description": "Xanax 12ct"
    },
    {
      "isFelony": false,
      "title": "Failure to identification",
      "description": "No ID"
    }
  ],
  "recoveredItems": [
    "Xanax 12ct",
    "Whisky bottle"
  ]
}

Response body

{
  "createdAt": "2016-06-04T00:00:00.000Z",
  "updatedAt": "2016-06-04T00:00:00.000Z",
  "officer": "c67e3855-442d-49fd-95b2-7f01201a9218",
  "type": "ARREST",
  "location": {
    "street": "Fake Street",
    "city": "Sandy Shores"
  },
  "ped": {
    "firstName": "John",
    "lastName": "Doe",
    "dob": "08/08/1988",
    "gender": "M"
  },
  "statement": "Individual was traveling at excess speeds and failed to yield. A high speed persuit begun",
  "charges": [
    {
      "isFelony": true,
      "title": "Grand Theft",
      "description": "Stolen vehicle 132ABC"
    },
    {
      "isFelony": true,
      "title": "Possession of controlled substance",
      "description": "Xanax 12ct"
    },
    {
      "isFelony": false,
      "title": "Failure to identification",
      "description": "No ID"
    }
  ],
  "recoveredItems": [
    "Xanax 12ct",
    "Whisky bottle"
  ],
  "_id": "26923b9a-c550-4a4a-9a26-c96bd36f207f"
}

 

If there are any developers who would like to utilize this let me know. If there are any devs who feel comfortable making the HTTP calls themselves before I put out the library, I can grant them access to the API and the swagger explorer page -- this will provide you with the schema definitions and a testing bed for the calls.

Screen Shot 2016-06-04 at 4.55.17 PM.png

There is also an ability to generate callouts and properties server side and dispatch them to the player. Using an mqtt client, there could be a plugin that can alert players about a suspect who escaped (like a bolo) or generates the name and properties of a call out to start for the player

Edited by ainesophaur
Link to comment
Share on other sites

  • Management Team

This is actually something we're working on for the next release of LSPDFR and the return of our crime statistics system, but I'm sure a lot of third-party developers may appreciate your approach. :smile:

Imitation is the sincerest form of flattery.

Link to comment
Share on other sites

There's actually something already in the works for this...like, almost exactly the same. We actually may be able to combine our efforts... (Cyan, we've spoken to LMS about it) 

@AlconH

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Link to comment
Share on other sites

57 minutes ago, Stealth22 said:

There's actually something already in the works for this...like, almost exactly the same. We actually may be able to combine our efforts... (Cyan, we've spoken to LMS about it) 

@AlconH

I actually messaged a few times with @AlconH but I was under the impression that his API was more strictly to be used by the MDT/Computer+ plugins that are being merged. I would love to provide the API if our efforts could be merged because it's what I excel at, but I didn't want to step on any toes since his API would use PHP. I didn't want to pry into how free @AlconH's schedule was as mine is quite clear or his progress in developing the API.

I'm going to write up a sample plugin which gets a top 10 global (maybe region and global) daily wanted list. Once the subject is arrested (or killed) I'll mark them off the BOLO and notify all players that fugitive has been captured. I'd love to establish a bi-directional communication between plugins and the API server and receive events in real time.

Link to comment
Share on other sites

  • Management Team

The ultimate goal on our end would be integration with the website, which I'm sure users would appreciate as we had with LCPDFR.

I think are going to end up going with our own thing or anything that would be open sourced. Capacity is of course an issue, and whichever solution we adopted would have to scale to the LSPDFR playerbase. (the old LCPDFR crime statistics/usage statistics server was written in node.js and proxied via nginx to handle the load for example)

Imitation is the sincerest form of flattery.

Link to comment
Share on other sites

15 minutes ago, Cyan said:

The ultimate goal on our end would be integration with the website, which I'm sure users would appreciate as we had with LCPDFR.

I think are going to end up going with our own thing or anything that would be open sourced. Capacity is of course an issue, and whichever solution we adopted would have to scale to the LSPDFR playerbase. (the old LCPDFR crime statistics/usage statistics server was written in node.js and proxied via nginx to handle the load for example)

Scalability is why i use Nodejs :) horizontal scaling ftw.

I would love to authenticate against the lcpdfr site.. Is there any logic that I can tap into? If the users profile page had a token that could be used to auth that would work out perfectly for anyone wanting to auth their plugin.

If you guys baked this into lcpdfr and it was open sourced Id love to help maintain it.. I've done nearly everything with nodejs

Link to comment
Share on other sites

It isn't going to be strictly for Computer+, as far as I know. He was going to design it so any plugin could hook into it. 

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Link to comment
Share on other sites

I would absolutely love to be part of anything like this, I've had the idea myself but lack the time to invest in the initial setup (and I'm already managing far too many web projects to take anything extra on). Anything that makes for a more immersive unified "world" that brings us even a millimeter closer to LSPDFR Online would be amazingly awesome IMO!

My YouTube Channel: Darkmyre Gaming (Australian LSPDFR patrols, plugins in development, and other games)

My Discord Server | AusGamer Network

 

Please do not PM me for technical support or bug reports, use the appropriate forum or plugin's comments instead.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...