Git Product home page Git Product logo

rapidmail-apiv3-client-php's People

Contributors

eth8505 avatar mklewitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rapidmail-apiv3-client-php's Issues

API returns empty result on more than one status in filter

$queryResult returns a non empty query result (OK)

            $queryResult = $recipientService->query([
                'recipientlist_id' => $listId,
                'status' => ['new']
            ]);

$queryResult also returns a non empty query result (OK)

            $queryResult = $recipientService->query([
                'recipientlist_id' => $listId,
                'status' => ['active']
            ]);

In this case $queryResult always returns an empty query result (BUG)

            $queryResult = $recipientService->query([
                'recipientlist_id' => $listId,
                'status' => ['new','active']
            ]);

And also this case $queryResult always returns an empty query result (BUG)

            $queryResult = $recipientService->query([
                'recipientlist_id' => $listId,
                'status' => 'new,active'
            ]);

It would also be very helpful to implement 'all' as vaid status as it is used on the rapidmail website. Example: https://my.rapidmail.de/recipient/list.html?recipientlist_id=123&status=all

recipient:create leads to exception on some environments

There seems to be a problem with some certain environment combinations and the RapidMail php client

Use case:
I am creating new recipients via API.

$client = new Client(
    $_ENV['RAPIDMAIL_API_KEY'],
    $_ENV['RAPIDMAIL_API_PASS']
);
$recipientsService = $client->recipients();
try {
    $createRecipientResponse = $recipientsService->create([
        'recipientlist_id' => $recipientList,
        'email' => $formVariables['email'],
        'firstname' => $formVariables['firstname'],
        'lastname' => $formVariables['lastname'],
        'zip' => $formVariables['zip'],
        'foreign_id' => ($insertedUid > 0) ? $insertedUid : '--n/a--',
    ],
    [
        'send_activationmail' => 'yes'
    ]);
} catch (ApiClientException $e) {
    // [...]
}

What happens?:

  • data is submitted to API
  • RapidMail processes submitted data
  • ActivationMail is sent
  • returnCode is created / 201
  • ApiClient runs into an exception
Uncaught GuzzleHttp\Exception\RequestException: cURL error 56: OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0 

This only happens on remote production server which is out of my control, in development-environment everything works as expected.

Sounds very similar to #14 but I can connect from the remote server to API via openssl-command on CLI and run the curl command on cli with no problems.

Then I tried to dive deeper into the problem and created minimalistic scripts one only with php-curl, one only with guzzle and one using the RapidMail-client. Expecting that curl and guzzle would also fail. But they pass.

object(GuzzleHttp\Psr7\Response)#33 (6) { ["reasonPhrase":"GuzzleHttp\Psr7\Response":private]=> string(7) "Created" ["statusCode":"GuzzleHttp\Psr7\Response":private]=> int(201) ["headers":"GuzzleHttp\Psr7\Response":private]=> array(11) { ["Server"]=> array(1) { [0]=> string(5) "nginx" } ["Date"]=> array(1) { [0]=> string(29) "Wed, 21 Feb 2024 11:24:19 GMT" } ["Content-Type"]=> array(1) { [0]=> string(20) "application/hal+json" } ["Transfer-Encoding"]=> array(1) { [0]=> string(7) "chunked" } [...]

Any clue what could have gone wrong with the client on the failing environments?

further information

PHP-environment with client working:

openssl version
OpenSSL 1.1.1w  11 Sep 2023

curl --version
curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1w zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09, security patched: 7.74.0-1.3+deb11u11
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

php --version
PHP 7.4.33 (cli) (built: Sep  4 2023 08:11:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

php -i | grep -i openssl
SSL Version => OpenSSL/1.1.1w
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1w  11 Sep 2023
OpenSSL Header Version => OpenSSL 1.1.1n  15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

PHP-environment when client fails:

openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

curl --version
curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

php --version
PHP 7.4.33 (cli) (built: Aug 17 2023 12:56:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with the ionCube PHP Loader + ionCube24 v13.0.2, Copyright (c) 2002-2023, by ionCube Ltd.

php -i | grep -i openssl
SSL Version => OpenSSL/3.0.2
libSSH Version => libssh/0.9.6/openssl/zlib
libmongoc SSL library => OpenSSL
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.2 15 Mar 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled
openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

curl --version
curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

php --version
PHP 8.2.13 (cli) (built: Dec  6 2023 07:49:07) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.13, Copyright (c) Zend Technologies
    with the ionCube PHP Loader v13.0.2, Copyright (c) 2002-2023, by ionCube Ltd.

php -i | grep -i openssl
SSL Version => OpenSSL/3.0.2
libSSH Version => libssh/0.9.6/openssl/zlib
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.2 15 Mar 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
Native OpenSSL support => enabled

Create recipients throws exception on 201

Hi,
I try to create user via $response = $service->create(/* PAYLOAD /, / OPTIONAL MODIFIER */);
The user is created and the response is 201, but it seems that an exception is thrown on 201.

try {
  $recipientsService = $this->newsletterClient->recipients();
  $response = $recipientsService->create($payload, $modifier);
 } catch (ApiClientException $e) {
  $this->logger->error($e->getMessage());
}

Jul 6 15:24:44 |ERROR| APP API error 201 when requesting https://apiv3.emailsys.net/v1/recipients?send_activationmail=no&track_stats=yes. Detail: {"id":"10198387","recipientlist_id":"1744", ... }}}

Best,
Ronny

/mailings query filter 'updated_since' always returns 400 Bad Request

The documentation says updated_since can be set to a DateTime in the format Y-m-d H:i:s. This will be transmitted as a URL-encoded GET-parameter, like updated_since=2020-04-08%2016%3A46%3A54 for the DateTime 2020-04-08 16:46:54. This results in an API error response 400 Bad Request with the message:

API error 400 when requesting https://apiv3.emailsys.net/v1/mailings?updated_since=2020-04-01. Detail: {"validation_messages":{"updated_since":{"datetimeInvalidDateTime":"The input does not appear to be a valid datetime"}},"type":"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html","title":"Bad Request","status":400,"detail":"Failed Validation"}

Any way I try to format the date results in the same error. UNIX epoch timestamp, 2020-04-08, nothing seems to be acceepted.

As an aside: the code

$this->setAttributeRaw('created_since', $this->stringifyDateTime($dateTime));
sets the wrong GET parameter.

Outdated dependencies / project still maintained?

Hi,

I would like to use the Rapidmail API Client to connect Statamic (statamic.com) forms to Rapidmail. So far so good, still I think that some dependencies should be updated to keep compatibility high.

When trying to install the rapidmail api client via composer, the following error is coming up. Is this something which will be updated on your end in the future, or should i deal with it by forking the package? :)


  Problem 1
    - rapidmail/rapidmail-apiv3-client-php[1.0.0-beta, ..., 1.0.1] require guzzlehttp/guzzle ^6.3 -> found guzzlehttp/guzzle[6.3.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
    - Root composer.json requires rapidmail/rapidmail-apiv3-client-php ^1.0 -> satisfiable by rapidmail/rapidmail-apiv3-client-php[1.0.0-beta, 1.0.0, 1.0.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.```

Deprecated function: PHP 8.1

Package version: 1.1.0
PHP version: 8.1

Description:

Deprecated function: Return type of Rapidmail\ApiClient\Service\Response\HalResponseResourceIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 10 of โ€ฆ/vendor/rapidmail/rapidmail-apiv3-client-php/src/Service/Response/HalResponseResourceIterator.php).

Steps To Reproduce:

Create a new subscription under PHP 8.1.

      $this->apiClient->recipients()->create(
        $data,
        [
          'send_activationmail' => 'yes',
        ]
      );

creat new list got error 404:Exception raised: API error 404 when requesting https://apiv3.emailsys.net/v1/recipientlists. Detail: <html>

Hello
For getting a list of emails from the recipientlists or adding an item to an existing list, everything works correctly.

        ///test get list recipient
        $listService = $client->recipientlists();

        foreach ($listService->query() as $list) {
            var_dump($list);
        }

        $recipientsService = $client->recipients();
        $recipientsService->create(
        // Dataset: Represents the recipient dataset you're creating
            [
                'recipientlist_id' => $list['id'], // Required
                'email' => '[email protected]', // Required
                'firstname' => 'Test first name',
                'lastname' => 'Test last name',
                'gender' => 'male',
                'status' => "active"
            ],
        );

But when I try to use the recipientlists method to create a new list I got an error

        $serviceCreate = $client->recipientlists();
        try {
        $response = $serviceCreate->create([
            [
                'name' => 'test', // Required
                'description' => 'test create list', 
                'unsubscribe_blacklist' => 'no',
                'recipient_subscribe_email' => 'no',
                'default' => 'no',
            ],
        ]);
            die($response);
        } catch (ApiClientException $e) {
            echo "Exception raised: " . $e->getMessage();

        }

I got error 404

Exception raised: API error 404 when requesting https://apiv3.emailsys.net/v1/recipientlists. Detail: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Support "tags" field when creating/updating recipients

When creating or updating recipients for a specific recipients list, updating recipient's tags should be possible.
The following code returns 422:

$recipientsService = $client->recipients();
$recipientsService->create(
  array(
    'recipientlist_id' => 1234, // some existing list id
    'email' => '[email protected]',
    'firstname' => 'Firstname',
    'lastname' => 'Lastname',
    'tags' => array('some_tag')
));

Response:
"API error 422 when requesting https://apiv3.emailsys.net/v1/recipients. Detail: {\"type\":\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html\",\"title\":\"Unprocessable Entity\",\"status\":422,\"detail\":\"Unrecognized fields: tags\"}"

When submitting forms created in Rapidmail (using html embed code), tags are supported, though.

Using ${var} in strings is deprecated, use {$var} instead

  • Using ${var} in strings is deprecated, use {$var} instead
    vendor/rapidmail/rapidmail-apiv3-client-php/src/Util/PlatformRequirements.php:36

  • Using ${var} in strings is deprecated, use {$var} instead
    vendor/rapidmail/rapidmail-apiv3-client-php/src/Util/PlatformRequirements.php:46

  • Using ${var} in strings is deprecated, use {$var} instead
    vendor/rapidmail/rapidmail-apiv3-client-php/src/Service/ServiceFactory.php:57

  • Using ${var} in strings is deprecated, use {$var} instead
    vendor/rapidmail/rapidmail-apiv3-client-php/src/Service/ServiceFactory.php:65

  • Using ${var} in strings is deprecated, use {$var} instead
    vendor/rapidmail/rapidmail-apiv3-client-php/src/Service/ServiceFactory.php:78

Fatal error: During inheritance of ArrayAccess

Description:

There is currently a compatibility error when using package version 1.1.0 with PHP 8.1. which results in a fatal error.
Its possible to fix the issue by using the dev-master version of the package in my project.

Package data:

  • Package version: 1.1.0
  • PHP version: 8.1.8

Error:

During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Rapidmail\ApiClient\Service\Response\HalResponse::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.