Skip to Content

API connectivity error

Hi All,

We are trying to test one of the SAP_API functionality in our ecc server but getting the below error.

Error :-

Testing API 1

response:
Application Server Error 404 Resource not found Partner not reached ##Error is logged with Tag: {00000366}

Below actions are tested till now ,

1. In 000 client configured the proxy settings for this connection.

2.Applied the certificate in SSL Client standard ( Github certificate installed)

3. Restarted ICM.

4. Finally trying to execute the below report ,

Report :-/////////////

*&---------------------------------------------------------------------*
*& Report API_TEST
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT API_TEST.
DATA: lo_http_client TYPE REF TO if_http_client.
DATA: response TYPE string.

"create HTTP client by url
"API endpoint for API sandbox
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = 'https://sandbox.api.sap.com/translationhub/api/v1/domains'
"API endpoint with optional query parameters
"url = 'https://sandbox.api.sap.com/translationhub/api/v1/domains'

IMPORTING
client = lo_http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.

"Available API Endpoints
"https://saptranslation-{subaccountname}.hanatrial.ondemand.com/translationhub/api/v1
"https://sap{providersubaccountname}-{subscriptionsubaccountname}.hana.ondemand.com/translationhub/api/v1
"https://sap{providersubaccountname}-{subscriptionsubaccountname}.ap1.hana.ondemand.com/translationhub/api/v1
"https://sap{providersubaccountname}-{subscriptionsubaccountname}.eu1.hana.ondemand.com/translationhub/api/v1
"https://sap{providersubaccountname}-{subscriptionsubaccountname}.us1.hana.ondemand.com/translationhub/api/v1
"https://sap{providersubaccountname}-{subscriptionsubaccountname}.us2.hana.ondemand.com/translationhub/api/v1

IF sy-subrc <> 0.
"error handling
ENDIF.

"setting request method
lo_http_client->request->set_method('GET').
"adding headers
lo_http_client->request->set_header_field( name = 'Content-Type' value = 'string' ).
lo_http_client->request->set_header_field( name = 'Accept' value = 'application/json; charset=utf-8' ).
"API Key for API Sandbox
lo_http_client->request->set_header_field( name = 'APIKey' value = 'Our Value' ).

"Available Security Schemes for productive API Endpoints
"Basic Authentication
"Basic Auth : provide username:password in Base64 encoded in Authorization header
"lo_http_client->request->set_header_field( name = 'Authorization' value = '<Base64 encoded value>' ).
CALL METHOD lo_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL METHOD lo_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 5.
ENDIF.

IF sy-subrc <> 0.
"error handling
ENDIF.

response = lo_http_client->response->get_cdata( ).

WRITE: 'response: ', response.

//////////////////////////////////////////////////////////////////////////////

I have few queries , to function this report what are the per-requisites we need to perform.

1. Do we need to setup any RFC connection for this communication ??

2. Is there any port to be opened ?

Please put all your thoughts here.

Really appreciate your inputs for this query.

Thanks

Pradeep.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jul 17 at 07:59 AM

    Hi All,

    Issue got fixed after applying sandbox.api.sap websites certificate to sap abap system in the strust.

    Thanks all for your help.

    Thanks

    Pradeep.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 15 at 06:29 AM

    Hi Pradeep,

    I assume that ECC layer is on-premise and API created and managed by SAP API Management is on the cloud.

    Please use SAP Cloud Connector to connect to your on-prem ECC system

    Please refer blog Cloud Connector as a bridge connecting SAP API Management and On-Premise System

    Regards,

    Raghavendra Kulkarni

    Add comment
    10|10000 characters needed characters exceeded