QR codes
On this page:
THE QR CODE COLOR OBJECT |
|
THE QR CODE ICON OBJECT |
|
POST[base]/qrcodes |
|
GET[base]/qrcodes/colors |
|
GET[base]/qrcodes/colors/{colorId} |
|
POST[base]/qrcodes/colors |
|
PUT[base]/qrcodes/colors/{colorId} |
|
DELETE[base]/qrcodes/colors/{colorId} |
|
GET[base]/qrcodes/icons |
|
GET[base]/qrcodes/icons/{iconId} |
|
POST[base]/qrcodes/icons |
|
PUT[base]/qrcodes/icons/{iconId} |
|
DELETE[base]/qrcodes/icons/{iconId} |
The QR code color object
This object provides the following data about a QR code color:
- colorId string
The identifier of a color.
- name string
The name of a color.
- priority integer
The color sequence number, as displayed in the B2Core UI.
- background string
A hexadecimal code for the background color of the QR code.
- foreground string
A hexadecimal code for the foreground color of the QR code.
- createTime string
The date and time when the object has been created.
- updateTime string
The date and time when the object has been last updated.
{
"colorId": "6006dda272f002519c3eb505",
"name": "Black",
"priority": 1,
"background": "#000000",
"foreground": "#ffffff",
"createTime": "2021-01-01T00:00:00+00:00",
"updateTime": "2021-01-01T00:00:00+00:00"
}
The QR code icon object
This object provides the following data about a QR code icon:
- iconId string
The identifier of the QR code icon.
- name string
The name of the QR code icon.
- priority integer
The icon sequence number, as displayed in the B2Core UI.
- image string
The Base64-encoded image file.
- createTime string
The date and time when the object has been created.
- updateTime string
The date and time when the object has been last updated.
{
"iconId": "6006dda272f002519c3eb505",
"name": "Icon",
"priority": 1,
"image": "iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAYAAAAYwiAhAAATkklEQVR42uxdC3Bc1Xn+7r37klaSJfktP2Tjh2ywMeCQmEcpBjdxKAnU9SQQk3jSoQlNO2Q6mVA",
"createTime": "2021-01-01T00:00:00+00:00",
"updateTime": "2021-01-01T00:00:00+00:00"
}
Generate a QR code
Use this method to generate a QR code.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Body:
- uri string required
The link to which a QR code leads.
- iconId string
The identifier of a QR code icon.
- colorId string
The identifier of a QR code color.
- format string
The QR code icon format. Possible values:
png
svg
- size integer
The QR code size, in pixels.
- background string
A hexadecimal code for the background color of the QR code.
The string value length can’t exceed 7 characters.
- foreground string
A hexadecimal code for the foreground color of the QR code.
The string value length can’t exceed 7 characters.
POST[base]/qrcodes
curl --location --request POST 'https://your.base-url.here/qrcodes' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"uri": "https://my.stage.org/register?referral=1",
"iconId": "6006dda272f002519c3eb505",
"colorId": "6006dda272f002519c3eb505",
"format": "png",
"size": 1000,
"background": "#000000",
"foreground": "#ffffff"
}'
Response
Body:
In case of success, the response contains a Base64-encoded generated QR code.
{
"qrCode": "iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAYAAAAYwiAhAAATkklEQVR42uxdC3Bc1Xn+7r37klaSJfktP2Tjh2ywMeCQmEcpBjdxKAnU9SQQk3jSoQlNO2Q6mVA"
}
Get a list of QR code colors
Use this method to obtain a collection of available colors for QR codes.
To obtain detailed information about a specified QR code color, use a separate method to get QR code color details.
Request
Header parameters:
Authorization: Bearer <token>
Query parameters:
This method supports pagination, sorting, and filtering. For details on applying the parameters, refer to the Query parameters section. Possible parameters for filtering and sorting are listed below. For values description, refer to the QR code color object.
Possible values for the filter
parameter:
name
priority
background
foreground
Possible values for the sort_by
parameter:
name
priority
background
foreground
createTime
updateTime
GET[base]/qrcodes/colors
curl --location -g --request GET 'https://your.base-url.here/qrcodes/colors?limit=10&offset=0&sort_by=createTime&filter[colorPriority]=1&filter[colorName]=Black&filter[colorBackground]=%23000000&filter[colorForeground]=%23ffffff' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, the response body contains an array of QR code color objects providing information about the available colors that correspond to the query parameters specified in the request.
Get QR code color details
Use this method to obtain detailed information about a specified QR code color.
To obtain a list of QR code colors, use a separate method to get a list of QR code colors.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- colorId required
The QR code color identifier.
GET[base]/qrcodes/colors/{colorId}
curl --location --request GET 'https://your.base-url.here/qrcodes/colors/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, the response body contains a QR code color object providing information about the specified color.
Add a new QR code color
Use this method to add a new color for QR codes.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Body:
- name string required
The name of the QR code color.
The string value length can’t exceed 255 characters.
- background string required
A hexadecimal code for the background color of the QR code.
The string value length can’t exceed 7 characters.
- foreground string required
A hexadecimal code for the foreground color of the QR code.
The string value length can’t exceed 7 characters.
POST[base]/qrcodes/colors
curl --location --request POST 'https://your.base-url.here/qrcodes/colors' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "Black",
"background": "#000000",
"foreground": "#ffffff"
}'
Response
Body:
In case of success, the response body contains a QR code color object providing information about the newly created color.
Update a QR code color
Use this method to update a specified QR code color.
Note
Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Path parameters:
- colorId required
The identifier of a QR code color.
Body:
Values of the following fields can be updated:
- name string
The name of the QR code color.
The string value length can’t exceed 255 characters.
- background string
A hexadecimal code for the background color of the QR code.
The string value length can’t exceed 7 characters.
- foreground string
A hexadecimal code for the foreground color of the QR code.
The string value length can’t exceed 7 characters.
- priority integer
The color sequence number, as displayed in the B2Core UI.
PUT[base]/qrcodes/colors/{colorId}
curl --location --request PUT 'https://your.base-url.here/qrcodes/colors/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "Black",
"background": "#000000",
"foreground": "#ffffff",
"priority": 1
}'
Response
Body:
In case of success, the response body contains a QR code color object providing information about the updated color.
Delete a QR code color
Use this method to delete a specified QR code color.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- colorId required
The identifier of a QR code color.
DELETE[base]/qrcodes/colors/{colorId}
curl --location --request DELETE 'https://your.base-url.here/qrcodes/colors/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, no response body is returned.
Get a list of QR code icons
Use this method to obtain a list of icons available for QR codes.
To obtain detailed information about a specified QR code icon, use a separate method to get QR code icon details.
Request
Header parameters:
Authorization: Bearer <token>
Query parameters:
This method supports pagination, sorting, and filtering. For details on applying the parameters, refer to the Query parameters section. Possible parameters for filtering and sorting are listed below. For values description, refer to the QR code icon object.
Possible values for the filter
parameter:
iconPriority
iconName
imageIcon
Possible values for the sort_by
parameter:
name
priority
createTime
(default)updateTime
GET[base]/qrcodes/icons
curl --location -g --request GET 'https://your.base-url.here/qrcodes/icons?limit=10&offset=0&sort_by=createTime&filter[iconPriority]=1&filter[iconName]=Icon&filter[imageIcon]=iVBORw0KGgoAAAANSUhEUgAAAV4AAAFeCAAAAADoQCjGAAAABGdBTUEAALGPC' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, the response body contains an array of QR code icon objects providing information about all available QR code icons that correspond to the query parameters specified in the request.
Get QR code icon details
Use this method to obtain detailed information about a specified QR code icon.
To obtain a list of icons available for QR codes, use a separate method to get a list of QR code icons.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- iconId required
The identifier of a QR code icon.
GET[base]/qrcodes/icons/{iconId}
curl --location --request GET 'https://your.base-url.here/qrcodes/icons/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, the response body contains a QR code icon object providing information about the specified icon.
Add a new QR code icon
Use this method to add a new icon for the QR code.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Body:
- name string required
The name of a QR code icon.
- imageIcon string required
The Base64-encoded icon file.
POST[base]/qrcodes/icons
curl --location --request POST 'https://your.base-url.here/qrcodes/icons' \
--header 'Authorization: Bearer <token>' \
--form 'name="Icon"' \
--form 'imageIcon=@"/path/to/file"'
Response
Body:
In case of success, the response body contains a QR code icon object providing information about the newly created icon.
Update a QR code icon
Use this method to update a specified QR code icon.
Note
Instead of the method described below, you can use a similar method that uses the HTTP verb PATCH.
Request
Header parameters:
Authorization: Bearer <token>
Content-Type: application/json
Path parameters:
- iconId required
The identifier of a QR code icon.
Body:
Values of the following fields can be updated:
- name string
The name of a QR code icon.
- priority integer
The icon sequence number, as displayed in the B2Core UI.
PUT[base]/qrcodes/icons/{iconId}
curl --location --request PUT 'https://your.base-url.here/qrcodes/icons/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
"name": "Icon",
"priority": 1
}'
Response
Body:
In case of success, the response body contains a QR code icon object providing information about the updated icon.
Delete a QR code icon
Use this method to delete a specified QR code icon.
Request
Header parameters:
Authorization: Bearer <token>
Path parameters:
- iconId required
The identifier of a QR code icon.
DELETE[base]/qrcodes/icons/{iconId}
curl --location --request DELETE 'https://your.base-url.here/qrcodes/icons/60ba407d15951453e60e49f8' \
--header 'Authorization: Bearer <token>'
Response
Body:
In case of success, no response body is returned.