Hallo are CRUD operation possible on the profile/shipping information?
tx
Simone

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cimo75 created an issue. See original summary.

tyler.frankenstein’s picture

Title: Commerce profiles and shipping information » Customer profile CRUD
Assigned: Unassigned » tyler.frankenstein
Category: Support request » Feature request
Priority: Normal » Major
Status: Active » Needs review
FileSize
22.38 KB

With the following patch, we can now have CRUD operations for Customer Profiles. Without this, it's very difficult to build Orders, since we have to create/update customer profiles and attach them to orders using the customer profile entity id(s).

Create & Update

Create - POST: ?q=api/customer-profile.json
Update - PUT: ?q=api/customer-profile/123.json

Example JSON Data to POST/PUT:

{
  "type": "billing",
  "commerce_customer_address": {
    "country": "US",
    "administrative_area": "CA",
    "sub_administrative_area": null,
    "locality": "Hollywood",
    "dependent_locality": null,
    "postal_code": "90210",
    "thoroughfare": "123 Fake Street",
    "premise": null,
    "sub_premise": null,
    "organisation_name": null,
    "name_line": "Randy Random",
    "first_name": "Randy",
    "last_name": "Random",
    "data": null
  }
}

Retrieve & DELETE

Retrieve - GET: ?q=api/customer-profile/123.json
Delete - DELETE: ?q=api/customer-profile/123.json

Disclaimer

This patch also contains numerous other RTBC patches (sorry, but I did not want to back track and I do not know enough patch-fu to be able to pull these ones out temporarily):

ruvenshilpakar’s picture

@tyler.frankenstein thank you for your patch. However, when i applied it and tested the customer-profile services, i am getting an access denied for user name response. I do not understand why is it occurring? could you please assist me on this?

tyler.frankenstein’s picture

i am getting an access denied for user name response.

I don't understand this, please be more specific. All permissions run through Commerce permission functions, so any access denied messages are most likely due to your commerce permission settings.

GET: @see commerce_services_customer_profile_retrieve_access()
POST: @see commerce_services_customer_profile_create_access()
PUT: @see commerce_services_customer_profile_update_access()
DELETE: @see commerce_services_customer_profile_delete_access()

ruvenshilpakar’s picture

@tyler.frankenstein
I looked it into the 4 functions, there are no issues there, i should be getting 401 error response based on those but i am getting a 403 error response, (which unlike 401 request, authenticating will not make any difference)

Media Crumb’s picture

Was this patch added into master or will i still need to apply. Thanks!

upunkt’s picture

"Dev is all you need", don't remember that Beatles-tune?