Method Not Allowed

malviyaash18
Helper

Method Not Allowed

#!/usr/bin/python3

import requests
from requests_toolbelt.utils import dump

def main():

CA_CERT = "D:\Yash Malviya\Documents\VISA Certificates\DigiCertGlobalRootCA.pem"
CLIENT_CERT = "D:\Yash Malviya\Documents\VISA Certificates\cert.pem"
PRIVATE_KEY = "D:\Yash Malviya\Documents\VISA Certificates\privateKey.pem"
USER_ID = "4NMZDCBKZEZTSYTJQPI8212CZN1i0awjHfuceminS_f-eQya4"
PASS = "tm0S2ufMN9jAR"

HEADERS = {'Accept': 'application/json', 'Content-Type': 'application/json'}
BODY = ""

r = requests.post(URL,
verify = (CA_CERT),
cert = (CLIENT_CERT, PRIVATE_KEY),
headers = HEADERS,
auth = (USER_ID, PASS),
data = BODY)

data = dump.dump_all(r)
print(data.decode('utf-8'))
print(r.json())


if __name__ == "__main__":
main()
 
Response:
 
{'responseStatus': {'status': 405, 'code': '9004', 'severity': 'ERROR', 'message': 'Method Not Allowed', 'info': ''}}
4 REPLIES 4
API_Products
Visa Developer Support Specialist

Re: Method Not Allowed

Hey @malviyaash18,

 

For Visa Developer error codes, go here - https://developer.visa.com/pages/visa-developer-error-codes

 

The project is trying to hit an URI/http method combination that does not exist. 

Refer to the API documentation to validate you are hitting the right endpoint.

 

To further investigate, please provide the following information:

1. End Point
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body

Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.

 




Thanks,

Diana



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

malviyaash18
Helper

Re: Method Not Allowed

All the required details are mentioned above in my Python Code. I think there is a issue in syntax of URL.

API_Products
Visa Developer Support Specialist

Re: Method Not Allowed

Hey @malviyaash18,

 

Is your Method Not Allowed issue resolved? 




Thanks,

Diana



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

jules21
Regular Visitor

Re: Method Not Allowed

405 Method Not Allowed response status code usually means you either tried a GET on something that only allows POST, or vice-versa, or tried http: on a method that requires https.

same here that URL(https://sandbox.api.visa.com/vdp/helloworld) takes Get Method and you're using POST method while making a request. 

in order to correct that error change your request method to GET