POST /api/:space/achievements/icon-uploads

Description:

Upload an icon via API to CompetitionLabs.

Resource URL:

https://<apphost>.competitionlabs.com/api/<your-space-name>/achievements/icon-uploads

Request header

KeyValueRequired
X-API-KEY
Your unique API keyYes
Content-Type
application/jsonYes
Accept-Encoding
gzip, deflateYes
Content-Lengthlength of fileYes
content-typemultipart/form-dataYes

Request URL parameter

Parameter
Type
Required
Description
space
StringYesThis is the space name which is linked to the account


Post body parameters 

The file has to be sent as "multipart/form-data". The content key/name has to be "file". The value inserted has to be an image that you want to upload.

EXAMPLE

Request
curl
  --header 'Accept-Encoding: gzip, deflate' 
  --header 'Content-Length: 69112' 
  --header 'Content-Type: application/x-www-form-urlencoded' 
  --header 'X-API-KEY: <your-api-key>' 
  --header 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' 
  --request POST https://app.competitionlabs.com/api/tester/achievements/icon-uploads 
  -F file=@/usr/home/files/image.jpg
Response
{
    "meta": {
        "time": "2019-11-06T16:40:52.335Z"
    },
    "data": {
        "jsonClass": "Attachment",
        "attachmentType": "achievement-icons",
        "bucketName": "demo.competitionlabs.com",
        "md5Hash": "DwBM27/fIsfRHnHuG1heIw==",
        "accountId": "0sn4DmUBkPH_lz9GgxBM",
        "fileName": "3D5.jpg",
        "mimeType": "image/jpeg",
        "extension": "jpg",
        "locationKey": "margarita/achievement-icons/3D5.jpg",
        "locationFolder": "margarita/achievement-icons",
        "permission": 744,
        "created": "2019-11-06T16:40:52.302+0000",
        "metadata": [],
        "id": "nriXQW4Bl-kxmqaGG-tS"
    }
}

ERROR CODES

CodeHTTP StatusDescriptionExample
1007404
  • The X-API-KEY is incorrect
  • Incorrect space name
Error Response 404
{
    "errors": [
        {
            "message": "No key found for value - [123345567888edgddfgdrgd]",
            "code": 1007,
            "status": 404
        }
    ]
}
Error Response 404
{
    "errors": [
        {
            "message": "No account found for space name - [test]",
            "code": 1007,
            "status": 404
        }
    ]
}
1002404

The form-data that is sent is incorrect

  • The key is missing or incorrect
  • The value is missing or incorrect
Error Response 404
{
    "errors": [
        {
            "message": "Mandatory parameter missing.",
            "code": 1002,
            "status": 404
        }
    ]
}

404

The Request URL is incorrect

Error Response 404
{
    "status": 404
}

401

The X-API-KEY is missing

Error Response 401
{
    "status": 401
}