Archive message
Archive request
URL: https://api.courier.com/requests/:request_id/archive
Method: PUT
Path Parameters
request_idstringrequired
A unique identifier representing the request ID
Response
status: 202 ACCEPTED
Request Example
- cURL
- Node.js
- Ruby
- Python
- Go
- PHP
curl --request PUT \
--url https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive \
--header 'Accept: application/json'
// Dependencies to install:
// $ npm install node-fetch --save
const fetch = require('node-fetch');
const options = {
method: 'PUT',
headers: {
Accept: 'application/json'
},
};
fetch('https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Accept"] = 'application/json'
response = http.request(request)
puts response.read_body
# Dependencies to install:
# $ python -m pip install requests
import requests
url = "https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive"
headers = {
"Accept": "application/json"
}
response = requests.request("PUT", url, headers=headers)
print(response.text)
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive"
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Accept", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
<?php
// Dependencies to install:
// $ composer require guzzlehttp/guzzle
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PUT', 'https://api.courier.com/requests/1-61e9dd53-b5bb6c863b7ffbe83ad4b28d/archive', [
'headers' => [
'Accept' => 'application/json',
],
]);
echo $response->getBody();
Responses Example
Empty
Usage
Messages that are sent to a list or audience can be archived in bulk using this API with the returned request_id. You most likely would not need to use this API unless you're specifically building around this use-case. Reach out to Courier Support if you have any questions.
Example
Method: PUT
URL: https://api.courier.com/requests/1-62bbd4dc-d0a17ebd6ec04e7bbab5de60/archive