Skip to content

Latest commit

 

History

History
97 lines (79 loc) · 2.45 KB

API.md

File metadata and controls

97 lines (79 loc) · 2.45 KB

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

jwtLogin

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 jwtAuth

View Authorization

"Authorization" field of request header: Bearer XXXXX jwtAuthorization

option 3: Basic Auth

set Basic auth

set Basic Auth Type: superadmin/1234567890

basicAuth

View Authorization

"Authorization" field of request header: Basic c3VwZXJhZG1pbjoxMjM0NTY3ODkw basicAuthorization

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

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

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

curl -u 'superadmin:1234567890' -F "[email protected]" "https://demo.crudapi.cn/api/business/product/import"