A FiveM remote api to control trigger events.
- Resource configuration is handled using cfx convars.
- Example event register script Aik-10/gists.
set api:accessToken "change_me" # Authentication string
set api:logLevel "error" # 'debug' | 'info' | 'warn' | 'error'
set api:enableCors "true"
set api:port "4290"
POST
/EventHandler/{event}/{source}
name type data type description event required string N/A source optional string N/A GET arg optional string string[]
http code content-type response 200
application/json
Registered event return values
400
application/json
{"code":"400","status": "error","message":"Bad Request"}
401
application/json
{"code":"401","status": "error","message":"Unauthorized user"}
404
application/json
{"code":"404","status": "error","message":"Exception message"
curl --location 'http://127.0.0.1:4290/EventHandler/test_with_args/10?arg=1' \ --header 'x-access-key: change_me'
exports.rest_api:RegisterRestApiEvent( 'test_with_args', function(source, a, b) print("test_with_args", source,a,b); return source,a,b end);
POST
/TriggerClientEvent/{event}/{source}
name type data type description event required string N/A source required string N/A GET arg optional string string[]
http code content-type response 200
application/json
TriggerClientEvent({event}, {source}) Triggered
400
application/json
{"code":"400","status": "error","message":"Bad Request"}
401
application/json
{"code":"401","status": "error","message":"Unauthorized user"}
404
application/json
{"code":"404","status": "error","message":"Exception message"
curl --location 'http://127.0.0.1:4290/TriggerClientEvent/trigger:client:test/10' \ --header 'x-access-key: change_me'
POST
/TriggerServerEvent/{event}/{source}
name type data type description event required string N/A source optional string N/A GET arg optional string string[]
http code content-type response 200
application/json
TriggerClientEvent({event}, {source}) Triggered
400
application/json
{"code":"400","status": "error","message":"Bad Request"}
401
application/json
{"code":"401","status": "error","message":"Unauthorized user"}
404
application/json
{"code":"404","status": "error","message":"Exception message"
curl --location 'http://127.0.0.1:4290/TriggerServerEvent/trigger:server:test' \ --header 'x-access-key: change_me'