File size: 2,506 Bytes
039608f | 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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | # swagger api
https://demo.crudapi.cn/swagger-ui.html
# user
superadmin/1234567890
# login
## option 1: Cookie
### api
```
POST https://demo.crudapi.cn/api/auth/login
accept: application/json
content-type: application/x-www-form-urlencoded
username: superadmin
password: 1234567890
```
## option 2: Jwt token
### api
```
POST https://demo.crudapi.cn/api/auth/jwt/login
accept: application/json
content-type: application/x-www-form-urlencoded
username: superadmin
password: 1234567890
```

### get jwt token
get "token" field form response header: Bearer XXXXX
### set jwt token
#### set Bearer Token Type: Bearer XXXXX
Both "Bearer XXXXX" and "XXXX" is valid

#### View Authorization
"Authorization" field of request header: Bearer XXXXX

## option 3: Basic Auth
### set Basic auth
#### set Basic Auth Type: superadmin/1234567890

#### View Authorization
"Authorization" field of request header: Basic c3VwZXJhZG1pbjoxMjM0NTY3ODkw

# logout
GET https://demo.crudapi.cn/api/auth/logout
# create user
POST https://demo.crudapi.cn/api/business/user
```
{
"name": "testuser",
"username": "testuser",
"password": "testuser",
"enabled": true,
"accountNonExpired": true,
"accountNonLocked": true,
"credentialsNonExpired": true,
"fileId": null,
"avatar": null,
"roleLines": [{
"name": "业务数据角色",
"role": {
"id": 20,
"name": "业务数据角色",
},
"roleId": 20
}]
}
```
# curl example
get sequence by id
```bash
curl -u 'superadmin:1234567890' -X GET -H 'Content-Type: application/json' 'https://demo.crudapi.cn/api/metadata/sequences/1'
curl -H 'Authorization:Basic c3VwZXJhZG1pbjoxMjM0NTY3ODkw' -X GET -H 'Content-Type: application/json' 'https://demo.crudapi.cn/api/metadata/sequences/1'
```
create sequence
```bash
curl -u 'superadmin:1234567890' -X POST -H 'Content-Type: application/json' -d '{"currentTime":false,"sequenceType":"STRING","minValue":1,"maxValue":999999999,"nextValue":1,"incrementBy":1,"name":"orderCode","caption":"订单流水号","format":"SO_%9d"}' 'https://demo.crudapi.cn/api/metadata/sequences'
```
import excel data
```bash
curl -u 'superadmin:1234567890' -F "file=@product.xlsx" "https://demo.crudapi.cn/api/business/product/import"
```
|