Files
sf-nfc-server/docs/nfc-server/Generate activation label.yml

128 lines
2.7 KiB
YAML
Raw Normal View History

2026-03-10 15:44:48 +01:00
info:
name: Generate an activation label
type: http
seq: 2
http:
method: POST
url: "{{baseUrl}}/nfc/generate"
body:
type: json
data: |-
{
2026-03-17 12:26:31 +01:00
"card_id": "019cdd39-fc08-7417-b16d-a78794a24c01",
2026-03-10 15:44:48 +01:00
"override": false
}
auth: inherit
2026-03-10 16:34:04 +01:00
runtime:
scripts:
- type: tests
code: |-
test("Should return 200", () => {
const body = res.getBody()
expect(res.getStatus()).to.equal(200)
})
2026-03-10 16:38:15 +01:00
test("Body must include a data field", () => {
const body = res.getBody()
expect(body.data).to.not.be.undefined
2026-03-10 16:38:15 +01:00
})
2026-03-10 16:34:04 +01:00
test("Body should include the label", () => {
const body = res.getBody()
expect(body.data.label).to.not.be.undefined
2026-03-10 16:38:15 +01:00
})
2026-03-10 16:34:04 +01:00
2026-03-10 15:44:48 +01:00
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
examples:
- name: 200 Response
description: Label generated or reused successfully
request:
url: "{{baseUrl}}/nfc/generate"
method: POST
body:
type: json
data: |-
{
"card_id": "019cd877-ab5f-718c-9d77-3cbf6972e535",
2026-03-10 15:44:48 +01:00
"override": false
}
{
"card_id": "019cd877-ab5f-718c-9d77-3cbf6972e535",
"override": true
}
{
"card_id": "019cd877-ab5f-718c-9d77-3cbf6972e535",
}
2026-03-10 15:44:48 +01:00
response:
status: 200
statusText: OK
headers:
- name: Content-Type
value: application/json
body:
type: json
data: |-
{
"code": "",
"label": "",
"overriden": false,
"reused": false
}
- name: 422 Response
description: Validation error
request:
url: "{{baseUrl}}/nfc/generate"
method: POST
body:
type: json
data: |-
{
"card_id": "1234", // no es un uuid valido
2026-03-10 15:44:48 +01:00
"override": false
}
response:
status: 422
statusText: Unprocessable Entity
headers:
- name: Content-Type
value: application/json
body:
type: json
data: |-
{
"error": {
"msg": "El campo card_id no es un uuidv7",
"field": "card_id"
2026-03-10 15:44:48 +01:00
}
}
- name: 500 Response
description: Internal server error
request:
url: "{{baseUrl}}/nfc/generate"
method: POST
body:
type: json
data: |-
{
2026-03-10 16:34:04 +01:00
"card_id": "",
2026-03-10 15:44:48 +01:00
"override": false
}
response:
status: 500
statusText: Internal Server Error
body:
type: text
2026-03-10 16:34:04 +01:00
data: |-
{
"error": ""
}