Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Solved! Go to solution
shameem
Visa Employee

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hi @murotovb ,

 

Looks like you have made few changes to the code which we have provided on the forum. 

I would request you to try with our code without any modifications except replacing the placeholders.

 

If you still unable to get it running, share with us the "X-Correlation-ID".  You can print it by adding the line at the end.

 

log.Println("Response Header:", resp.Header.Get("X-Correlation-ID"))

 

Thank you.

murotovb
New Contributor

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hi @shameem,

 

I've tried with the sample code without any modification. Still have the same error.

X-Correlation-ID: 1718275730_365_1219024619_-546f65b8c9_VDP_WSimage.png

API_Products
Visa Developer Support Specialist

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hi @murotovb,

 

Please provide the following information, in text (not screenshot) so that I can copy/paste the information for engineering. Thanks.

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

You can find the x-correlation-id in 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.

murotovb
New Contributor

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

2024/06/14 09:29:20 REQ End Point https://sandbox.api.visa.com/vdp/helloworld
2024/06/14 09:29:20 REQ Header map[Authorization:[Basic Q1BTTTVMS1NVNFVGVkNKUk5MQ1QyMVFsX3ctQjVVR3NyVFRPcTh4eWJ3NFdFMGE3UTpvQVRxdGtveHJ1SzNCTVVPbTB1ZWRwMTRlbms=]]
2024/06/14 09:29:20 REQ Body <nil>


2024/06/14 09:29:21 RESP Header map[Cache-Control:[no-cache, no-store, must-revalidate] Connection:[keep-alive] Content-Length:[130] Content-Security-Policy-Report-Only:[default-src 'self' https://*.v.me https://*.visa.com;script-
src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object
-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;] Content-Type:[application/json] Date:[Fri, 14 Jun 2024 04:29:20 GMT] Expires:[-1] Pragma:[no-cache] Server:[nginx] Strict-Transport-Security:[max-age
=31536000;includeSubdomains] X-App-Status:[400] X-Content-Security-Policy-Report-Only:[default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src
'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;] X-
Content-Type-Options:[nosniff] X-Correlation-Id:[1718339360_051_1149832663_-6686d654f5k5_VDP_WS] X-Error-Origin:[9100] X-Frame-Options:[SAMEORIGIN] X-Served-By:[-6686d654f5k5] X-Vdp-Authn-Api-Visa-Id:[HELLOWORLD] X-Vdp-Normalized-
Url:[/vdp/helloworld] X-Webkit-Csp-Report-Only:[default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval' https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;] X-Xss-Protection:[0]]
2024/06/14 09:29:21 Response Status: 400
2024/06/14 09:29:21 Response Body: {"responseStatus":{"status":400,"code":"9123","severity":"ERROR","message":"Expected input credential was not present","info":""}}

API_Products
Visa Developer Support Specialist

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hi @murotovb,

 

Please see the below cause and resolution for the 400 error. Please try the following to resolve the error and share your result with us.

Payload and URI Error Codes

HTTP STATUS HTTP CODE CAUSE/RESOLUTION

BAD REQUEST

400

This error could be due to a variety of reasons.

Check for the following:

  • The url has a space after the ?.
  • Whitespace issues, in general, anywhere in the url.
  • Ideally the following fields need to be checked for correctness:
    •  URL
    •  Query params

Or

  • The API endpoint you are trying to use only supports Two-Way SSL authentication. Please ensure you are not using any other token type.

Or

  • Invalid input found in the request payload.

 




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.

murotovb
New Contributor

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hi @API_Products,

The problem is not related to wrong URL or payload.

If I add spaces in URL I'm getting the following error:

2024/06/18 10:06:53 Response Header: 1718687213_611_397713529_-546f65b8t42_VDP_WS
2024/06/18 10:06:53 Response Status: 404
2024/06/18 10:06:53 Response Body: {"responseStatus":{"status":404,"code":"9005","severity":"ERROR","message":"Requested route not found","info":""}}

API_Products
Visa Developer Support Specialist

Re: helloworld.go - How to run GoLang Sample Code using the Hello World API and Mutual SSL

Hey @murotovb,

 

Here's the cause/resolution for error code 404. You can also refer to the Visa Developer Error Codes page here.

NOT FOUND

404

The project is trying to hit an endpoint that does not exist.

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

 




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.