From 4fca62a8ee24524b65d6b4526e0f8e3397b7e797 Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Tue, 10 Oct 2023 17:24:44 +0200 Subject: rest: extend /repository/add POST /repository/add checks validity of the repository ip address specified in the request payload. /repository/add can optionally receive a center id parameter inside its request payload. For backward compatibility, the default center id (1) is used if no center is received inside the request payload. POST /repository/add returns a JSON response payload containing relevant fields from the inserted repository. $ curl -D- \ -X POST \ -H "Authorization: a0e9ab768cbe93dab5b1998e952bcdb7" \ --json '{"name": "helloworld", "ip": "192.168.21.21a", "center": 2}' \ localhost:8888/repository/add HTTP/1.1 400 Bad Request Content-Length: 0 $ curl -D- \ -X POST \ -H "Authorization: a0e9ab768cbe93dab5b1998e952bcdb7" \ --json '{"name": "helloworld", "ip": "192.168.21.21a", "center": 2}' \ localhost:8888/repository/add HTTP/1.1 200 OK Content-Length: 54 {"id": 7, "ip": "192.168.21.21", "name": "helloworld"} --- src/dbi.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/dbi.h') diff --git a/src/dbi.h b/src/dbi.h index ab393e7..8db3a9c 100644 --- a/src/dbi.h +++ b/src/dbi.h @@ -106,6 +106,7 @@ struct og_room { }; struct og_repository { + unsigned int center; char name[OG_DB_REPO_NAME_MAXLEN]; char ip[OG_DB_IP_MAXLEN]; }; -- cgit v1.2.3-18-g5258