Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

Solved! Go to solution
JavierSivack
Regular Contributor

Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

Hello,

I'm trying to test these api:

https://sandbox.api.visa.com/vctc/customerrules/v1/consumertransactioncontrols/customer/{userIdentif...}

these is my request body:

{"lastName":"Carlos","firstName":"Perez","countryCode":"USA","isProfileActive":true,"preferredLanguage":"en-us","defaultAlertsPreferences":[{"status":"Active","isVerified":true,"callingCode":"1","contactType":"Email","contactValue":"email@test.com","preferredEmailFormat":"Plain"}]}

 

and its response is these:

{"responseStatus":{"status":405,"code":"9004","severity":"ERROR","message":"Method Not Allowed","info":""}}

Any idea what can I be doing wrong?

 

Thanks. 


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
4 REPLIES 4
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

Hi @JavierSivack,

 

Please use the PATCH method. I tried your test payload and I got below response.

 

{
"receivedTimestamp": "2021-09-15 03:23:39.535",
"processingTimeinMs": 1302,
"resource": {
"isProfileActive": true,
"firstName": "Perez",
"lastName": "Carlos",
"userIdentifier": "913f11f6-92a3-4f9f-9a69-c9c59f1133c3",
"preferredCountryCode": "USA",
"preferredLanguage": "en-us",
"defaultAlertsPreferences": [
{
"contactType": "Email",
"contactValue": "email@test.com",
"status": "Active",
"isVerified": true,
"preferredEmailFormat": "Plain"
}
],
"lastUpdateTimeStamp": "2021-09-15 03:23:40",
"createdOnDate": "2021-09-10 21:57:35.015"
}
}


Best,
Stacey

Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.
JavierSivack
Regular Contributor

Re: Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

Hi Stacy, 

This is my postman request:

PATCH /vctc/customerrules/v1/consumertransactioncontrols/customer/?apiKey=MY_API_KEY&userIdentifier=0b0b8965-cffb-4d92-829f-8bd9891e03da HTTP/1.1
Host: sandbox.api.visa.com
x-pay-token: {{x-pay-token}}
Accept: application/json
Content-Type: application/json
Content-Length: 426

{
    "lastName": "Carlos",
    "firstName": "Perez",
    "countryCode": "USA",
    "isProfileActive": true,
    "preferredLanguage": "en-us",
    "defaultAlertsPreferences": [
        {
            "status": "Active",
            "isVerified": true,
            "callingCode": "1",
            "contactType": "Email",
            "contactValue": "email@test.com",
            "preferredEmailFormat": "Plain"
        }
    ]
}

 This is my pre-request script:

var resourcePath = 'customerrules/v1/consumertransactioncontrols/customer/';
var queryParams = 'apiKey=MY_API_KEY&userIdentifier=0b0b8965-cffb-4d92-829f-8bd9891e03da';
var sharedSecret = 'V-sYZMEX1OfO1zsL/u8vxeo04+zwwxJyaGAKdQx$';
var postBody = pm.request.body.toString();

var timestamp = Math.floor(Date.now() / 1000);  
var preHashString = timestamp + resourcePath + queryParams + postBody;  
var hashString = CryptoJS.enc.Hex.stringify(CryptoJS.HmacSHA256(preHashString, sharedSecret));
var xPayToken = 'xv2:' + timestamp + ':' + hashString;

postman.setEnvironmentVariable('x-pay-token', xPayToken);

This is response header:

Server: nginx
Date: Wed, 15 Sep 2021 13:08:55 GMT
Content-Type: application/json
Content-Length: 107
Connection: keep-alive
X-SERVED-BY: l55c017
X-CORRELATION-ID: 1631711335_247_2066827139_l55c017_VDP_WS
X-APP-STATUS: 405

This is response body:

{"responseStatus":{"status":405,"code":"9004","severity":"ERROR","message":"Method Not Allowed","info":""}}

 

Sorry, I do not get my error. 

 

Thanks


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
JavierSivack
Regular Contributor

Re: Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

Hi Stacy, 

I had found the problem. I was sending userIdentifier as query param. And its mean to be pass as part of the path. 

Sending this (wrong):

PATCH /vctc/customerrules/v1/consumertransactioncontrols/customer/?apiKey=MY_API_KEY&userIdentifier=0b0b8965-cffb-4d92-829f-8bd9891e03da

instead of this (correct):

PATCH /vctc/customerrules/v1/consumertransactioncontrols/customer/0b0b8965-cffb-4d92-829f-8bd9891e03da?apiKey=MY_API_KEY

Thanks.


Javier Sivack
Software Engineer
Ciphertext Solutions, Inc.
SLi
Visa Developer Support Specialist
Visa Developer Support Specialist

Re: Alerts History and Customer Profiles API Update an Existing Customer Profile Method Not Allowed

That's great @JavierSivack! Glad you got it to work and thanks for sharing the correct path.


Best,
Stacey

Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.