-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHow_to_use_API.txt
68 lines (46 loc) · 2.1 KB
/
How_to_use_API.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
How to use Xaldigital API from centos
1-run in console
docker-compose up
2-In other console (but in xalApi folder)
docker-compose run --rm centos bash
3-Now check for the URL where de "web_1" is listen
this will be your URL-PATH from now.
API REQUEST'S with curl command
Check if API is available with
curl URL-PATH/ping
Read 1 row especifies the first_name
curl URL-PATH/API/READ/<first_name>
Note: The "<fisrt_name>" field would be replaced by the first_name
attribute of the row you need read
Read all table
curl URL-PATH/API/READ/ALL
Insert user
curl -X post URL-PATH/API/CREATE/<first_name>+<last_name>+<company_name>+<address>
Note: The "<fisrt_name>", "<last_name>", "<company_name>" and <address> fields must be replaced by the first_name, last_name, company_name, address of the user you need to insert
Delete row especifies by the first_name
DELETE
curl -X post URL-PATH/API/DELETE/<first_name>
Note: The "<fisrt_name>" field must be replaced by the first_name
attribute of the row you need delete
CREATE SCHEMA
curl -X post URL-PATH/API/CREATE/CHEMA/<sn>
Note: The <sn> field must be replaced by the name of your new schema
UPDATE SCHEMA
RENAME
curl -X post URL-PATH/API/RENAME/SCHEMA/<sn>+<nn>
Note: The <sn> field must be replaced by the SchemaName and <nn> by the new name
REOWNER
curl -X post URL-PATH/API/REOWNER/SCHEMA/<sn>+<no>
Note: The <sn> field must be replaced by the SchemaName and <no> by the new owner name. The new owner must be created befor use them. If you do not create them before then is going to set by "LOGGIN" only.
HOW TO CONNECT TO POSTGRES DB to check constraint and schemas
docker exec -it postgres psql -U postgres -d xaldigit
FOR CHECK CONSTRAINT WORKS:
INSERT INTO person (first_name, state) VALUES ('Alison', 'A2');
FOR CHECK SCHEMAS API WORKS:
\dn
FOR UNIT TESTING AND COVERAGE
In the host SO of docker container install python and coverage library
pip install coverage
Then in test_coverage>test_cov_api.py you must have to replace URL_API with the current URL-PATH where "web_1".
coverage run test_cov_api.py
coverage report