Discussions

Ask a Question
Back to All

405 Error on GetCompanyWsdkUrlCommand

Hi team,

Since 15 June I am getting this error

Request failed with status code: 405
Response content: {"Message":"The requested resource does not support http method 'GET'."}

This is the code I am using. It has been working for many months perfectly fine up until the past weekend. Can you please advise if there has been a change?

access_token, token_expiry_time = check_and_refresh_token(access_token, token_expiry_time)
headers = get_headers(access_token)

url = "http://apac-apilocator.corrigo.com/api/v1/cmd/GetCompanyWsdkUrlCommand"

# The payload
payload = {
    "Command": {
        "ApiType": "REST",
        "CompanyName": corrigo_company,
        "Protocol": "HTTPS"
    }
}

# Make the POST request
response = requests.post(url, headers=headers, data=json.dumps(payload))

# Check if the request was successful
if response.status_code == 200:
    # Parse the JSON response
    data = response.json()
    
    # Extract the URL from the response
    host_url = data["CommandResult"]["Url"]
    
    print(f"The correct host URL for your company is: {host_url}")
else:
    print(f"Request failed with status code: {response.status_code}")
    print(f"Response content: {response.text}")