Skip to content

UploadImage

Use this api to upload image.

POST /openapi/common/v1/image/upload

Request Parameters

Parameter Type Required Description
image file true The image file to upload, image format should be one of jpg,jpeg,png, max image size should be less than 2M, and image dimension should be between 256 * 256 and 4096 * 4096.

Response Parameters

Name Type Description
imageId string The unique id identity the file uploaded.
imageUrl string A network address of the file with an expire time.

Request Example

Example

curl -X POST  \
    -H "X-Advai-Country: ID" \
    -H "Authorization: {Your Access Key} + ':' + signature" \
    -H "Content-Type: multipart/form-data" \
    -f 'image=@image.png' \
    "{Ginee Host}/openapi/common/v1/image/upload"

Success

{
    "code":"SUCCESS",
    "message":"OK",
    "data":{
        "imageId":"OPEN_API_20210103145958545_3526665428.jpeg",
        "imageUrl":"https://genie-public.oss-ap-southeast-1-internal.aliyuncs.com/api/stag/images/OPEN_API_20210103145958545_3526665428.jpeg?Expires=1609657798&OSSAccessKeyId=LTAI4Fbzizhbxa6uodNzd9Y4&Signature=Pkns%2FTOb0g8vnwbhA930nspRYi8%3D"
    },
    "extra":null,
    "transactionId":"f49f370af5805764"
}

Invalid image format

{
    "code": "PARAMETER_ERROR",
    "message": "Invalid image format, image format should be one of jpeg/jpg/png.",
    "data": null,
    "extra": null
}