The page has been translated by Gen AI.

Message API reference

Overview

The Queue Service provided by Samsung Cloud Platform can send, receive, and delete messages.
In this guide, we provide an explanation of the Queue Service API and how to call it.

Queue Service Call Procedure

Queue Service API URL address must be changed according to the operating environment and region. Please check the operating environment and region information in the table below.

Operating EnvironmentRegionQueue Service URL
For Samsungkr-west1https://queueservice.service.kr-west1.s.samsungsdscloud.com
For Samsungkr-east1https://queueservice.service.kr-east1.s.samsungsdscloud.com
For Enterprisekr-west1https://queueservice.service.kr-west1.e.samsungsdscloud.com
For Enterprisekr-east1https://queueservice.service.kr-east1.e.samsungsdscloud.com

Calling API

AUTH PARAMS

Header Description
Scp-Accesskey      : Access Key issued from the Samsung Cloud Platform portal
Scp-Signature      : Signature that encrypts the called API request with the Access Secret Key mapped to the Access Key. The HMAC encryption algorithm uses HmacSHA256.
Scp-Target         : Action that requests the Queue Service. ScpQS.SendMessage, ScpQS.SendMessageBatch, ScpQS.ReceiveMessage, ScpQS.DeleteMessage, ScpQS.DeleteMessageBatch one of
Scp-Timestamp      : January 1, 1970 00:00:00 defines the elapsed time from Coordinated Universal Time (UTC) as milliseconds.
Scp-ClientType     : user-api specification

Create Signature

  • Generate the string to be signed from the request, encrypt it with HmacSHA256 algorithm using Access and Secret Key, then encode it in Base64.
  • Use this value as Scp-Signature.
  • The generated Signature is valid for 15 minutes.1. Click the All Services > Application > Queue Service menu. Navigate to the Service Home page of Queue Service.
Signature Generation Sample Code (Java)
public static String makeHmacSignature(String method,
                                       String url,
                                       String timestamp,
                                       String accessKey,
                                       String accessSecretKey,
                                       String clientType) {
  
    String body = method + url + timestamp + accessKey + clientType;
  
    String encodeBase64Str;
  
    try {
        byte[] message = body.getBytes("UTF-8");
        byte[] secretKey = accessSecretKey.getBytes("UTF-8");
  
        Mac mac = Mac.getInstance("HmacSHA256");
        SecretKeySpec secretKeySpec = new SecretKeySpec(secretKey, "HmacSHA256");
        mac.init(secretKeySpec);
        byte[] hmacSha256 = mac.doFinal(message);
        encodeBase64Str = Base64.getEncoder().encodeToString(hmacSha256);
    } catch (Exception e) {
        throw new RuntimeException("Failed to calculate hmac-sha256", e);
    }
  
    return encodeBase64Str;
}
Signature Generation Sample Code (JavaScript)

### Queue Service API Call Example
#### Curl
```commandline
curl -i -X GET
-H "Scp-Accesskey:2sd2gg=2agbdSD26svcD"
-H "Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef="
-H "Scp-Timestamp:1605290625682"
-H "Scp-ClientType:user-api"
-H "Scp-Target:ScpQS.SendMessage"
--data '{"MessageBody": "sample message",  "QueueUrl": "https://queueservice.kr-west1.e.samsungsdscloud.com/33ff0000a8a345d78cdf163673f3da11/samplequeue"}'
'https://queueservice.service.kr-west1.e.samsungsdscloud.com'

Python

import requests

url = "https://queueservice.service.kr-west1.e.samsungsdscloud.com"
payload = {
   'MessageBody': 'sample message',
   'QueueUrl': 'https://queueservice.kr-west1.e.samsungsdscloud.com/33ff0000a8a345d78cdf163673f3da11/samplequeue'
}
headers = {
  'Scp-Accesskey': '2sd2gg=2agbdSD26svcD',
  'Scp-Signature': 'fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=',
  'Scp-Timestamp': '1605290625682',
  'Scp-ClientType': 'user-api',
  'Scp-Target': 'ScpQS.SendMessage'
}

response = requests.request("GET", url, headers=headers, data=payload)

if response.status_code == 200:
    contents = response.text
    return contents
else:
    raise Exception(f"Failed to GET API: {response.status_code}, {response.text}")

Java

String apiUrl = "https://queueservice.service.kr-west1.e.samsungsdcloud.com";
String accessKey = "2sd2gg=2agbdSD26svcD"
String signature = "fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef="
String timestamp = "1605290625682"
String clientType = "user-api"
String scpTarget = "ScpQS.SendMessage"

public static String getAPI(String token, String apiUrl) throws IOException {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        HttpGet getRequest = new HttpGet(apiUrl);
        getRequest.addHeader("Scp-Accesskey", accessKey);
        getRequest.addHeader("Scp-Signature", signature);
        getRequest.addHeader("Scp-Timestamp", timestamp);
        getRequest.addHeader("Scp-ClientType", clientType);
        getRequest.addHeader("Scp-Target", scpTarget);

        HttpResponse response = httpClient.execute(getRequest);
        int statusCode = response.getStatusLine().getStatusCode();

        if (statusCode == 200) {
            String responseBody = EntityUtils.toString(response.getEntity());
            httpClient.close();
            return responseBody;
        } else {
            String responseBody = EntityUtils.toString(response.getEntity());
            httpClient.close();
            throw new RuntimeException("Failed to Request: " + statusCode + ", " + responseBody);
        }
    }

Queue Service API

SendMessage

POST https://queueservice.service.kr-west1.e.samsungsdscloud.com

Description

Send message

Parameters

Field NameRequiredTypeDescription
MessageAttributesfalseMessageAttribute
MessageBodytruestring
MessageDeduplicationIdfalsestringFIFO Queue
MessageGroupIdfalsestringFIFO Queue
QueueUrltruestring
MessageAttribute
Field NameRequiredTypeDescription
BinaryValuefalsestring
DataTypefalsestring
StringValuefalsestring

Responses

HTTP CodeDescriptionSchema
200Created
400Bad Request
403Forbidden

Example HTTP request

Request Header
"Scp-Accesskey:2sd2gg=2agbdSD26svcD","
"Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=","


"Scp-Timestamp:1605290625682",
"Scp-ClientType:user-api","
Scp-Target:ScpQS.SendMessage
Request Body
{
  "QueueUrl": "https://queueservice.kr-west1.e.samsungsdscloud.com/123e54b7303749f38ca59a5c6d419a75/test",
  "MessageBody": "Hello SQS!",
  "MessageAttributes": {
    "Special": {
      "DataType": "string",
      "StingValue": "testBodyString12345678910!/wow$#@!"
    }
  }
}

Example HTTP response

200 Response
{
  "MD5OfMessageAttributes": "139818cac45117a07428826a8c533c01",
  "MD5OfMessageBody": "098f6bcd4621d373cade4e832627b4f6",
  "MessageId": "14b37b86-8117-484a-aea4-1eae3b98d5d0",
  "SequenceNumber": "11764568839"
}

SendMessageBatch

POST https://queueservice.service.kr-west1.e.samsungsdscloud.com

Description

Bulk message sending

Parameters

Field NameRequiredTypeDescription
Entriestruearray of SendMessageBatchRequestEntry
QueueUrltruestring
SendMessageBatchRequestEntry
Field NameRequiredTypeDescription
Idtruestring
MessageAttributesfalseMessageAttribute
MessageBodytruestring
MessageDeduplicationIdfalsestringFIFO Queue
MessageGroupIdfalsestringFIFO Queue

Responses

HTTP CodeDescriptionSchema
200Created
400Bad Request
403Forbidden

Example HTTP request

Request Header

“Scp-Accesskey:2sd2gg=2agbdSD26svcD”, “Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=”,"

“Scp-Timestamp:1605290625682”," “Scp-ClientType:user-api”," Scp-Target:ScpQS.SendMessageBatch


###### Request Body
```json
{
   "QueueUrl": "https://queueservice.kr-west1.dev3.samsungsdscloud.com/123e54b7303749f38ca59a5c6d419a75/test",
   "Entries": [
      {
         "Id": "1",
         "MessageBody": "test-body-1"
      },
      {
         "Id": "2",
         "MessageBody": "test-body-2"
      }
   ]
}

Example HTTP response

200 Response
{
   "Failed": [],
   "Successful": [
      {
         "Id": "2",
         "MD5OfMessageAttributes": "d41d8cd98f00b204e9800998ecf8427e",
         "MD5OfMessageBody": "82ddf04637119b9a77e9b44095f5ba11",
         "MessageId": "68aa4629-bfbc-4bb0-898b-52db94438526",
         "SequenceNumber": "31764583416"
      },
      {
         "Id": "1",
         "MD5OfMessageAttributes": "d41d8cd98f00b204e9800998ecf8427e",
         "MD5OfMessageBody": "8344ca2f91203b151e4d0aafc9248a8b",
         "MessageId": "3523740f-9e7c-429e-8514-5ec21b1d3cd8",
         "SequenceNumber": "41764583416"
      }
   ]
}

ReceiveMessage

POST https://queueservice.service.kr-west1.e.samsungsdscloud.com

Description

Message reception

Parameters

Field NameRequiredTypeDescription
MaxNumberOfMessagesfalsestring
MessageAttributeNamesfalsearray of string
MessageSystemAttributeNamesfalsearray of string
QueueUrltruestring
WaitTimeSecondsfalsestring

Responses

HTTP CodeDescriptionSchema
200Created
400Bad Request
403Forbidden

Example HTTP request

Request Header
"Scp-Accesskey:2sd2gg=2agbdSD26svcD","
"Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=",
"Scp-Timestamp:1605290625682","
"Scp-ClientType:user-api",
Scp-Target:ScpQS.ReceiveMessage
Request Body
{
   "QueueUrl": "https://queueservice.kr-west1.dev3.samsungsdscloud.com/123e54b7303749f38ca59a5c6d419a75/test",
   "MaxNumberOfMessages": "2"
}

Example HTTP response

200 Response
{
   "messages": [
      {
         "MessageId": "14b37b86-8117-484a-aea4-1eae3b98d5d0",
         "Body": "sample-body-1",
         "Attributes": {},
         "MessageAttributes": {
            "Special": {
               "DataType": "string",
               "StingValue": "testBodyString12345678910!/wow$#@!"
            }
         },
         "MD5OfBody": "098f6bcd4621d373cade4e832627b4f6",
         "MD5OfMessageAttributes": "139818cac45117a07428826a8c533c01",
         "ReceiptHandle": "400tf1nY4HbXEP7UX4OtxPVIPlq9vw1eeKDFwNMeNiEuZvMSbvdPCBOF/P96FUF9XT7TALMzP91ViCxQjnOIyBWw+fr4EhihdJ0Z2QHau1LMHbxD+GngcM2Pv6d5HM4KCmBgB2GxFA5qpUFBPPI="
      },
      {
         "MessageId": "aee85517-1437-4877-8de8-00eee69e11dc",
         "Body": "sample-body-2",
         "Attributes": {},
         "MD5OfBody": "ad0234829205b9033196ba818f7a872b",
         "MD5OfMessageAttributes": "139818cac45117a07428826a8c533c01",
         "ReceiptHandle": "400tf1nY4HbXEP7UX4OtxPVIPlq9vw1eeKDFwNMeNiEuZvMSbvdPCBPVrfhxFxZ0XD7aBbEzP91Vi3pQ13KMxBWxrP74REyhKcgd2VLauFLMHbxD+GngcM2Pv6d5HCzyqhEoB9DHI5NmOhgaOJ4="
      }
   ]
}

DeleteMessage

POST https://queueservice.service.kr-west1.e.samsungsdscloud.com

Description

Delete message

Parameters

Field NameRequiredTypeDescription
QueueUrltruestring
ReceiptHandletruestring

Responses

HTTP CodeDescriptionSchema
200Created
400Bad Request
403Forbidden

Example HTTP request

Request Header

“Scp-Accesskey:2sd2gg=2agbdSD26svcD”," “Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=”, “Scp-Timestamp:1605290625682”, “Scp-ClientType:user-api”," Scp-Target:ScpQS.DeleteMessage


###### Request Body
```json
{
   "QueueUrl": "https://queueservice.kr-west1.dev3.samsungsdscloud.com/123e54b7303749f38ca59a5c6d419a75/test",
   "ReceiptHandle": "400tf1nY4HbXEP7UX4OtxPVIPlq9vw1eeKDFwNMeNiEuZvMSbvdPCBPVrfhxFxZ0XD7aBbEzP91Vi3pQ13KMxBWxrP74REyhKcgd2VLauFLMHbxD+GngcM2Pv6d5HCzyqhEoB9DHI5NmOhgaOJ4="
}

Example HTTP response

200 Response

DeleteMessageBatch

aiignore POST https://queueservice.service.kr-west1.e.samsungsdscloud.com


#### Description
Bulk message deletion

#### Parameters
| Field Name      | Required | Type                                      | Description |
|----------|-------|-----------------------------------------|----|
| Entries  | true  | array of DeleteMessageBatchRequestEntry |    |
| QueueUrl | true  | string                                  |    |

##### DeleteMessageBatchRequestEntry
| Field Name           | Required | Type     | Description |
|---------------|-------|--------|----|
| Id            | true  | string |    |
| ReceiptHandle | true  | string |    |

#### Responses

| HTTP  Code | Description	 | Schema |
|------------|--------------|--------|
| 200        | 	Created	    |        |
| 400        | 	Bad Request |        |
| 403        | 	Forbidden	  |        |


#### Example HTTP request

###### Request Header

“Scp-Accesskey:2sd2gg=2agbdSD26svcD”," Scp-Signature:fsfsdf235f9U35sdgf35Xsf/qgsdgsdg326=sfsdr23rsef=, “Scp-Timestamp:1605290625682”, “Scp-ClientType:user-api”," Scp-Target:ScpQS.DeleteMessageBatch


###### Request Body
```json
{
   "QueueUrl": "https://queueservice.kr-west1.dev3.samsungsdscloud.com/123e54b7303749f38ca59a5c6d419a75/test",
   "Entries": [
      {
         "Id": "1",
         "ReceiptHandle": "400tf1nY4HbXEP7UX4OtxPVIPlq9vw1eeKDFwNMeNiEuZvMSbvdPCBOF/P96FUF9XT7TALMzP91ViCxQjnOIyBWw+fr4EhihdJ0Z2QHau1LMHbxD+GngcMyJvqN5F17gym/YF4JoroeBXMSvIG0="
      },
      {
         "Id": "2",
         "ReceiptHandle": "400tf1nY4HbXEP7UX4OtxPVIPlq9vw1eeKDFwNMeNiEuZvMSbvdPCBOC8PwoFhV3Uj6JV+BnP90P3n1Q1y/RnhW0rv//GE6sf8EZjwfauVLMHbxD+GngcMyJvqN5F1Hs5T3vAZxgIV20IPdscTQ="
      }
   ]
}

Example HTTP response

200 Response
{
   "Failed": [],
   "Successful": [
      {
         "Id": "1"
      },
      {
         "Id": "2"
      }
   ]
}
Release Note
How to guides