curl --request POST \
--url https://api.myidvirtual.com/cupons \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"discount": 123,
"discountType": "<string>",
"maxUses": 123,
"expiresAt": "<string>",
"active": true
}
'{
"id": "123e4567-e89b-12d3-a456-426614174000",
"code": "PROMO2024",
"discount": 20,
"discountType": "PERCENTAGE",
"maxUses": 100,
"currentUses": 0,
"expiresAt": "2024-12-31T23:59:59.000Z",
"active": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
Cria um novo cupom de desconto
curl --request POST \
--url https://api.myidvirtual.com/cupons \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"discount": 123,
"discountType": "<string>",
"maxUses": 123,
"expiresAt": "<string>",
"active": true
}
'{
"id": "123e4567-e89b-12d3-a456-426614174000",
"code": "PROMO2024",
"discount": 20,
"discountType": "PERCENTAGE",
"maxUses": 100,
"currentUses": 0,
"expiresAt": "2024-12-31T23:59:59.000Z",
"active": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"code": "PROMO2024",
"discount": 20,
"discountType": "PERCENTAGE",
"maxUses": 100,
"currentUses": 0,
"expiresAt": "2024-12-31T23:59:59.000Z",
"active": true,
"createdAt": "2024-01-15T10:30:00.000Z"
}
curl --location --request POST 'http://localhost:3333/cupons' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"code": "PROMO2024",
"discount": 20,
"discountType": "PERCENTAGE",
"maxUses": 100,
"expiresAt": "2024-12-31T23:59:59.000Z",
"active": true
}'