Custom Server-Side API Endpoint
The Hardal Custom API allows you to interact with our server-side services through POST and GET requests. This document covers the usage of these requests, including required parameters and example requests.
Important: Ensure that your API requests are properly authenticated and that you are using the correct tokens. Exposing your API token publicly or using incorrect tokens can lead to unauthorized access or failed requests. Always keep your tokens secure and confidential. If you experience issues with authentication or authorization, refer to our contact support for assistance here.
POST Endpoint
Endpoint: /pubsub
Request Format
Parameter | Type | Required | Description |
---|---|---|---|
messages | Message[] | Yes | A list of messages to be sent |
pubsub | "gcp" | Yes | Pub/Sub cloud provider (e.g., AWS, GCP) |
Message Type
Field | Type | Description |
---|---|---|
value | string | The content of the message |
attributes | {"key": "value"} | Additional attributes related to the message |
messageId | string | The unique ID of the message |
publishTime | DateTime String | The time the message was sent (ISO 8601) |
Example POST Request
curl -X POST https://s2s.yourcustomdomain.com/pubsub \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR-HARDAL-SUPER-SECRET-TOKEN" \
-d '{
"messages": [
{
"value": "Test",
"attributes": {
"language": "English",
"greeting": "formal"
},
"messageId": "c1d7e88a-4e35-4e8e-9a0f-8c9fbd9d1123",
"publishTime": "2024-09-09T12:30:45.123Z"
}
],
"pubsub": "gcp"
}'
GET
/pubsub
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
CLICK_ID | string | Yes | The click ID |
PUBSUB | "gcp" | Yes | Pub/Sub cloud provider, such as AWS, GCP, etc. |
Extra Parameters | string | No | Additional query parameters are treated as attributes |
Example GET Request
curl "https://s2s.yourcustomdomain.com/pubsub?CLICK_ID=112233&PUBSUB=gcp¶m1=value1" \
-H "Authorization: Bearer YOUR-HARDAL-SUPER-SECRET-TOKEN"
Custom Endpoint
The endpoint for accessing the API can be customized based on your needs. To request a custom endpoint configuration, please use the following template to specify your requirements. This will help us set up the endpoint according to your needs.
Parameter | Description |
---|---|
Endpoint Path | Specify the desired path for your custom endpoint (e.g., /measurement ). |
Request Method | Indicate whether you need a GET or POST method for this endpoint. |
Query Parameters | List any query parameters you require, including their names, types, and whether they are required or optional. |
Request Body | Describe the structure of the request body, including any required fields and their types. |
Additional Configurations | Include any additional configurations or requirements you have for this endpoint. |
Example Request
Here is an example of how you might fill out the request template:
**Endpoint Path:**
/measurement
**Request Method:**
POST
**Request Body:**
```json
{
"value": "string",
"attributes": {
"key": "value"
},
"messageId": "string",
"publishTime": "DateTime String"
}