picture API
Overview
Function description
need to be combinedPush Android SDK v3.9.0Used in conjunction with versions above. Developers submit images or network resources URL toJiguangserver,JiguangIt will be adapted to various manufacturers according to the needs of developers. At the same time, developers will start fromJiguangGet the corresponding resourcesMediaID,ShouldMediaIDAvailable at Push API v3 Use it to achieve the need to push large pictures, large icons and small icons uniformly.
Calling address
https://api.jpush.cn/v3/images
Call verification
For details, see REST API Outlined Authentication method illustrate.
call limit
- Upload image size does not exceed 2M
- Pictures are saved for up to 30 days by default (from 2023-08-31 No. has been implemented, developers please pay attention)
- Special note: One picture corresponds to one picture resourcemedia_id
- API Request frequency limit and Push API v3 Interface sharing
Support and requirements for each channel
- The manufacturer channels that this interface can adapt to include:Jiguang、OPPO, Huawei, Honor andFCM;
- Xiaomi from 2023.08 Starting from the beginning, the official no longer supports the function of dynamically setting small icons, right icons, and large pictures when pushing on new devices/systems. Historical devices and applications are also gradually covered, which means that the functions of dynamically setting small icons, right icons, and large pictures when pushing are no longer supported;
- Currently, this interface does not provide file storage services, so please ensure that the image resources submitted are accessible and meet the requirements;
- Different channels have different support for different types of pictures, as shown in the following table:
Jiguangaisle Millet OPPO Huawei glory FCM big picture 1. supporthttp
2. supporthttps
3. Supports local resource paths and must besdcardrelative path, you need to specify the file suffix
- 1. supporthttp
2. supporthttps
- - 1. supporthttp
2. supporthttps
3. Supports local resource paths and must besdcardrelative path, you need to specify the file suffix
big icon 1. supporthttp
2. supporthttps
3. Support is located atdrawableThe icon path of the resource folder, no need to specify the file suffix
- 1. supporthttp
2. supporthttps
1. supporthttps
1. supporthttps
1. supporthttp
2. supporthttps
3. Support is located atdrawableThe icon path of the resource folder, no need to specify the file suffix
small icon 1. supporthttp
2. supporthttps
3. Support is located atdrawableThe icon path of the resource folder, no need to specify the file suffix
- - 1. Supports local resource paths and must be submitted with /raw/ The path at the beginning, no need to specify the file suffix 1. Supports local resource paths and must be submitted with /raw/ The path at the beginning, no need to specify the file suffix -
**Note: The above are only supported jpg 、 jpeg as well as png format resources. **
Add a new picture (URLWay)
Calling address
POST https://api.jpush.cn/v3/images/byurls
Function description
By specifying network image resourcesURLto add an adaptation in the form
Call example
Request Header
> POST /v3/images/byurls HTTP/1.1
> Content-Type: application/json
> Authorization: Basic MjhhMTBjMDkwNGI1Y2Q2MjJhYWRhZWIxOmU5ZmFhMmM5NzYzZGViZDIwZTdkZTFlYg==
Request data
{
"image_type": 2,
"image_url": "https://xx.com/xx.jpg",
"oppo_image_url": "https://xx.com/oppo.jpg",
"xiaomi_image_url": "https://xx.com/xiaomi.jpg",
"huawei_image_url": "",
"honor_image_url": "",
"fcm_image_url": "",
"jiguang_image_url": "https://xx.com/jiguang.jpg",
"hmos_image_url": "https://xx.com/hmos.jpg" // 20240813新增,适配鸿蒙上传图片
}
The complete parameter description is as follows:
| Keywords | Options | meaning |
|---|---|---|
| image_type | Required | Specify the image type to be adapted: 1 large image - 2 large icons - 3 small icons |
| image_url | Optional |
Public image address; If this field is set, when other fields do not set values, the content of this field will be used as the default value of other fields; For example: only this field andJiguangThe field has a value, and Xiaomi,OPPOIf the field has no value, Xiaomi,OPPOThe field value will be set to the same as the field value, but will not changeJiguangfield value. |
| jiguang_image_url | Optional | ConfigurationJiguangChannel image address |
| xiaomi_image_url | Optional |
Configure the image address of Xiaomi channel; If your application does not passJiguangIf the platform opens Xiaomi manufacturer channel, this field will not be processed; This interface will automatically adjust and compress the size of the image resources at this address to adapt to Xiaomi's requirements for the image. Please refer to the reference for specific requirements; If the size of the submitted image resource does not match, it will be proportionally scaled and adjusted in the form of white space without cropping the image. If the adaptation adjustment fails, an error will be returned. It is recommended to submit image resources that meet the requirements. Xiaomi manufacturers please refer to the image requirements. Xiaomi-image upload。 Xiaomi from 2023.08 Initially, the official no longer supports the function of dynamically setting small icons, right icons, and large pictures when pushing on new devices/systems. Historical devices and applications are also gradually being covered, which means that the functions of dynamically setting small icons, right icons, and large pictures when pushing are no longer supported. |
| oppo_image_url | Optional |
Configuration adaptationOPPOThe image address of the channel; If your application does not passJiguangPlatform openingOPPOIf the manufacturer channel is used, this field will not be processed; This interface will automatically adjust and compress the image resources at this address to fit the OPPO For the requirements for this picture, see the reference for details; If the size of the submitted image resource does not match, it will be proportionally scaled and adjusted in the form of white space without cropping the image; if the adaptation adjustment fails, an error will be returned; it is recommended to submit image resources that meet the requirements.OPPO Please refer to the manufacturer's requirements for this picture. OPPO-Image upload。 |
| huawei_image_url | Optional |
Configure the picture address of Huawei channel; If your application does not passJiguangIf the platform opens the Huawei manufacturer channel, this field will not be processed. |
| honor_image_url | Optional |
Configure the image address of the Honor channel; If your application does not passJiguangIf the platform opens the Honor manufacturer channel, this field will not be processed. |
| fcm_image_url | Optional |
Configuration FCM The image address of the channel; If your application does not passJiguangPlatform opening FCM If the manufacturer channel is used, this field will not be processed. |
| hmos_image_url | Optional |
Configure the image address of Hongmeng manufacturer; If your application does not passJiguangIf the Hongmeng manufacturer is enabled on the platform, this field will not be processed. |
Remark:
image_urlAnd the field values of each channel cannot be empty at the same time;- The specified manufacturer image field will only be processed if the manufacturer supports the corresponding image type; if the large image address of the Huawei manufacturer is configured, since the Huawei manufacturer does not support the large image type, the Huawei field in the result will be null.
Return example
Return successfully
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Success Response Data
{
"media_id": "jgmedia-2-14b23451-0001-41ce-89d9-987b465122da", // 得到的结果 media_id ,推送时可将该id作为参数传递给 Push 推送接口,具体见参考
"oppo_image_url": "3653918_5f92b5739ae676f5745bcbf4", // 适配 OPPO 要求后 OPPO 响应得到的 id
"xiaomi_image_url": "http://f6.market.xiaomi.com/download/MiPass/01fff50f50ba193f94074ec/d1671936d468383f.png", // 适配小米要求后小米响应得到的图标地址,小2023.08 开始不再支持
"huawei_image_url": "https://xx.com/xx.jpg", // 配置的华为图标地址
"honor_image_url": "https://xx.com/xx.jpg", // 配置的荣耀图标地址
"fcm_image_url": "https://xx.com/xx.jpg", // 配置的FCM图标地址
"jiguang_image_url": "https://xx.com/jiguang.jpg", // 配置的极光通道的图标地址
"hmos_image_url": "https://xx.com/xx.jpg" // 配置的鸿蒙图标地址,20240813新增
}
return on failure
HTTP/1.1 400 OK
Content-Type: application/json; charset=utf-8
Failed Response Data
{
"error": {
"code": 1002,
"message": "Missing authen info."
}
}
Add image (file method)
Calling address
POST https://api.jpush.cn/v3/images/byfiles
Function description
Add an adaptation by uploading an image file. This interface currently only supports Xiaomi and OPPO 。
**Note:**Xiaomi from 2023.08 Initially, the official no longer supports the function of dynamically setting small icons, right icons, and large pictures when pushing on new devices/systems. Historical devices and applications are also gradually being covered, which means that the functions of dynamically setting small icons, right icons, and large pictures when pushing are no longer supported.
Call example
curl --request POST 'https://api.jpush.cn/v3/images/byfiles' --header 'Content-Type: multipart/form-data' --header 'Authorization: Basic MjhhMTBjMDkwNGI1Y2Q2MjJhYWRhZWIxOmU5ZmFhMmM5NzYzZGViZDIwZTdkZTFlYg==' --form 'xiaomi_file=@/home/user/pictures/test_file1.jpg' --form 'oppo_file=@/home/user/pictures/test_file2.jpg' --form 'image_type=1'
The complete parameter description is as follows:
| Keywords | Options | meaning |
|---|---|---|
| image_type | Required | Specify the image type to be adapted: 1 large image - 2 large icons - 3 small icons |
| oppo_file | Optional |
Upload configurationOPPOChannel image file; This interface will verify the size of the image file. If it does not match OPPO If the picture is requested, an error will be returned.OPPO This picture is a reference for the requirements OPPO-Image upload。 |
| xiaomi_file | Optional |
Upload the image file to configure the Xiaomi channel This interface will verify the file size of the image. If it does not meet Xiaomi's requirements for the image, an error will be returned. Please refer to Xiaomi's requirements for the image. Xiaomi-image upload。 Xiaomi from 2023.08 The function of dynamically setting small icons, right icons, and large pictures during push is no longer supported. Developers can no longer set this field value. |
**Remark:oppo_fileandxiaomi_filecannot be empty at the same time. **
Return example
Return successfully
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Success Response Data
{
"media_id": "jgmedia-1-6d98e85f-d3a5-412a-bdec-de1b75bd3ad3", // 得到的结果 media_id ,推送时可将该id作为参数传递给 Push 推送接口,具体见参考
"oppo_image_url": "3653918_5f92b5739ae676f5745bcbf4", // 适配 OPPO 要求后 OPPO 响应得到的 id
"xiaomi_image_url": "http://f6.market.xiaomi.com/download/MiPass/01fff50f50ba193f94074ec/d1671936d468383f.png", // 适配小米要求后小米响应得到的图标地址
"huawei_image_url": "",
"honor_image_url": "",
"fcm_image_url": "",
"jiguang_image_url": ""
}
return on failure
HTTP/1.1 400 OK
Content-Type: application/json; charset=utf-8
Failed Response Data
{
"error": {
"code": 1002,
"message": "Missing authen info."
}
}
Update picture (URLWay)
Calling address
PUT https://api.jpush.cn/v3/images/byurls/{mediaId}
Function description
By specifying network image resourcesURLform to modify/update the adaptation results
Call example
Request Header
> PUT /v3/images/byurls/jgmedia-2-14b23451-0001-41ce-89d9-987b465122da HTTP/1.1
> Content-Type: application/json
> Authorization: Basic MjhhMTBjMDkwNGI1Y2Q2MjJhYWRhZWIxOmU5ZmFhMmM5NzYzZGViZDIwZTdkZTFlYg==
Request data
{
"oppo_image_url": "",
"xiaomi_image_url": "",
"huawei_image_url": "https://xx.com/new_huawei.jpg",
"honor_image_url": "https://xx.com/new_honor.jpg",
"fcm_image_url": "",
"jiguang_image_url": "http://xx.com/new_jiguang.jpg",
"hmos_image_url": "https://xx.com/hmos.jpg" // 适配鸿蒙更新图片,20240813新增
}
The complete parameter description is as follows:
| Keywords | Options | meaning |
|---|---|---|
| jiguang_image_url | Optional | Update configurationJiguangChannel image address |
| xiaomi_image_url | Optional |
Configure the image address of Xiaomi channel; If your application does not passJiguangIf the platform opens Xiaomi manufacturer channel, this field will not be processed; This interface will automatically adjust and compress the size of the image resources at this address to adapt to Xiaomi's requirements for the image. Please refer to the reference for specific requirements; If the size of the submitted image resource does not match, it will be proportionally scaled and adjusted in the form of white space without cropping the image. If the adaptation adjustment fails, an error will be returned. It is recommended to submit image resources that meet the requirements. Xiaomi manufacturers please refer to the image requirements. Xiaomi-image upload。 Xiaomi from 2023.08 The function of dynamically setting small icons, right icons, and large pictures during push is no longer supported. Developers can no longer set this field value. |
| oppo_image_url | Optional |
Configuration adaptationOPPOThe image address of the channel; If your application does not passJiguangPlatform openingOPPOIf the manufacturer channel is used, this field will not be processed; This interface will automatically adjust and compress the image resources at this address to fit the OPPO For the requirements for this picture, see the reference for details; If the size of the submitted image resource does not match, it will be proportionally scaled and adjusted in the form of white space without cropping the image; if the adaptation adjustment fails, an error will be returned; it is recommended to submit image resources that meet the requirements.OPPO Please refer to the manufacturer's requirements for this picture. OPPO-Image upload。 |
| huawei_image_url | Optional |
Configure the picture address of Huawei channel; If your application does not passJiguangIf the platform opens the Huawei manufacturer channel, this field will not be processed. |
| honor_image_url | Optional |
Configure the image address of the Honor channel; If your application does not passJiguangIf the platform opens the Honor manufacturer channel, this field will not be processed. |
| fcm_image_url | Optional |
Configuration FCM The image address of the channel; If your application does not passJiguangPlatform opening FCM If the manufacturer channel is used, this field will not be processed. |
| hmos_image_url | Optional |
Configure the image address of Hongmeng manufacturer; If your application does not passJiguangIf the Hongmeng manufacturer is enabled on the platform, this field will not be processed. |
Remark:
- The field values of each channel cannot be empty at the same time;
- If the manufacturer address of the updated configuration is not specified, the configuration result of the manufacturer retains the value before the update and will not be left blank;
- If the manufacturer that specifies the updated configuration does not support the corresponding type, the configuration results of that manufacturer will retain the values before the update and will not be overwritten.
Return example
Return successfully
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Success Response Data
{
"media_id": "jgmedia-2-14b23451-0001-41ce-89d9-987b465122da", // 更新的 media_id ,推送时可将该id作为参数传递给 Push 推送接口,具体见参考
"oppo_image_url": "3653918_5f92b5739ae676f5745bcbf4", // 适配 OPPO 要求后 OPPO 响应得到的 id
"xiaomi_image_url": "http://f6.market.xiaomi.com/download/MiPass/01fff50f50ba193f94074ec/d1671936d468383f.png", // 适配小米要求后小米响应得到的图标地址
"huawei_image_url": "https://xx.com/new_huawei.jpg", // 配置的华为图标地址
"honor_image_url": "https://xx.com/new_honor.jpg", // 配置的荣耀图标地址
"fcm_image_url": "https://xx.com/xx.jpg", // 配置的FCM图标地址
"jiguang_image_url": "http://xx.com/new_jiguang.jpg", // 配置的极光通道的图标地址
"hmos_image_url": "http://xx.com/new_hmos.jpg" // 配置的鸿蒙通道的图标地址,20240813新增
}
return on failure
HTTP/1.1 400 OK
Content-Type: application/json; charset=utf-8
Failed Response Data
{
"error": {
"code": 1002,
"message": "Missing authen info."
}
}
Update picture (file method)
Calling address
PUT https://api.jpush.cn/v3/images/byfiles/{mediaId}
Function description
Modify/update the adaptation results by uploading image files. This interface currently only supportsOPPO
**Note:**Xiaomi from 2023.08 Initially, the official no longer supports the function of dynamically setting small icons, right icons, and large pictures when pushing on new devices/systems. Historical devices and applications are also gradually being covered, which means that the functions of dynamically setting small icons, right icons, and large pictures when pushing are no longer supported.
Call example
curl --request PUT 'https://api.jpush.cn/v3/images/byfiles/jgmedia-1-6d98e85f-d3a5-412a-bdec-de1b75bd3ad3' --header 'Content-Type: multipart/form-data' --header 'Authorization: Basic MjhhMTBjMDkwNGI1Y2Q2MjJhYWRhZWIxOmU5ZmFhMmM5NzYzZGViZDIwZTdkZTFlYg==' --form 'xiaomi_file=@/home/user/pictures/test_file1.jpg' --form 'oppo_file=@/home/user/pictures/test_file2.jpg'
The complete parameter description is as follows:
| Keywords | Options | meaning |
|---|---|---|
| oppo_file | Optional |
Upload configurationOPPOChannel image file; This interface will verify the size of the image file. If it does not match OPPO If the picture is requested, an error will be returned.OPPO This picture is a reference for the requirements OPPO-Image upload。 |
| xiaomi_file | Optional |
Upload the image file to configure the Xiaomi channel This interface will verify the file size of the image. If it does not meet Xiaomi's requirements for the image, an error will be returned. Please refer to Xiaomi's requirements for the image. Xiaomi-image upload。 Xiaomi from 2023.08 The function of dynamically setting small icons, right icons, and large pictures during push is no longer supported. Developers can no longer set this field value. |
Remark:oppo_fileandxiaomi_fileCannot be empty at the same time
Return example
Return successfully
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Success Response Data
{
"media_id": "jgmedia-1-6d98e85f-d3a5-412a-bdec-de1b75bd3ad3", // 更新的 media_id ,推送时可将该id作为参数传递给 Push 推送接口,具体见参考
"oppo_image_url": "3653918_3_5f9a5f7cb3c87bf699b332a5", // 适配 OPPO 要求后 OPPO 响应得到的 id
"xiaomi_image_url": "http://f8.market.xiaomi.com/download/MiPass/0dfdb5eba1bbb8d1671983fdb2be94074ec/8a350da36d46835768f17f48a6b12b2765cec115.png", // 适配小米要求后小米响应得到的图标地址
"huawei_image_url": "",
"honor_image_url": "",
"fcm_image_url": "",
"jiguang_image_url": ""
}
return on failure
HTTP/1.1 400 OK
Content-Type: application/json; charset=utf-8
Failed Response Data
{
"error": {
"code": 1002,
"message": "Missing authen info."
}
}
Status code description
| Code | describe | Detailed explanation | HTTP Status Code |
|---|---|---|---|
| 1000 | System internal error | Server-side internal logic error, please try again later. | 500 |
| 1002 | Authentication failed | LackAuthorizationinformation | 400 |
| 1004 | Authentication failed |
1. AuthorizationintokenFormat error 2. appkeyinvalid 3. appkeyandmasterSecretno match |
401 |
| 1102 | Missing required parameters | Missing required parameters | 400 |
| 1103 | Parameter value is illegal |
1. Upload file is too large 2. File format is incorrect 3. submitted mediaId invalid 4. OPPO The number of uploaded images exceeds the daily limit. The limit is: Large images can be uploaded at most per day. 100 Zhang, large icons can be uploaded at most every day 500 Zhang, please refer to OPPO Official website description。 5. “the result is all of invalid"Please check whether the corresponding manufacturer channel is opened and configured and whether the image type is supported. 6. Other errors |
400 |
| 1030 | Service timeout |
1. Service internal call timeout 2. Image adapter manufacturer response timed out |
503 |
refer to
- HTTP Return code:HTTP-Status-Code
- HTTP Specification reference:HTTP basic authentication
- PushPush API:Push API v3
- OPPOPicture requirements:OPPO-Image upload
- Picture description of Huawei's downstream news:Huawei - Downward news
- Honor message picture description:glory API Access document