CMF REST-API Posting activity is not updating customer activities

Hello,

I am new to Pimcore and I am trying to use Pimcore as an MDM for creating a customer data management. We are using Pimcore v6.4.2 with Customer Managment Framework installed.

I am trying to use the REST API from the documentation for adding activity to a customer. Reading through the ActivitiesHandler code I can see that it requires a customerId field and the implementationClass is optional if we need to use a specific activity class.

I am making an API POST request using postman which looks like this:

/webservice/cmf/activities?apikey=<key>

payload:
{
	"customerId": <ID>,
	"customer": <ID>,
	"type": "Customer Login",
	"implementationClass": "AppBundle\\Model\\CustomerManagementFramework\\Activity\\LoginActivity"
}

But the response is always returning all the activities that are assigned to users. Looking through the Admin UI no activity is added to the customer passed.

On the docs there is no example with the payload that should be passed with the call and I am coming from JS/Node environment and trying to go through the PHP code is a little bit challenging in some occasions.

I appreciate any help and guidance.

Many thanks,
Thanos.

1 Like

For anyone that might have the same issue, I found the problem after some search. On Pimcore v6.4.2, Symfony version is 4.4.3 and annotations for routing have changed.

So if you go to:

/vendor/pimcore/customer-management-framework-bundle/src/Controller/Rest/CrudHandlerController.php

You can change the annotations from:

    /**
     * @param Request $request
     * @Route("")
     * @Method({"GET"})
     */

To:

    /**
     * @param Request $request
     * @Route("", methods={"GET"})
     */

I hope this might help someone with the same problems.

This post can be closed.

1 Like

@markoboy thanks a lot for the fix. It will be released in 2.5.3 version, please see https://github.com/pimcore/customer-data-framework/pull/159

1 Like