기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
SDK for SAP ABAP를 사용한 API Gateway 예제
다음 코드 예제에서는 API Gateway와 함께 AWS SDK for SAP ABAP를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시는 CreateDeployment의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->createdeployment( iv_restapiid = iv_rest_api_id iv_stagename = iv_stage_name iv_description = 'Deployment created by ABAP SDK' ). DATA(lv_deployment_id) = oo_result->get_id( ). MESSAGE 'Deployment created with ID: ' && lv_deployment_id TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 CreateDeployment를 참조하세요.
-
다음 코드 예시는 CreateResource의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->createresource( iv_restapiid = iv_rest_api_id iv_parentid = iv_parent_id iv_pathpart = iv_resource_path ). DATA(lv_resource_id) = oo_result->get_id( ). MESSAGE 'Resource created with ID: ' && lv_resource_id TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 CreateResource를 참조하세요.
-
다음 코드 예시는 CreateRestApi의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->createrestapi( iv_name = iv_api_name iv_description = 'Sample REST API created by ABAP SDK' ). DATA(lv_api_id) = oo_result->get_id( ). MESSAGE 'REST API created with ID: ' && lv_api_id TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. CATCH /aws1/cx_agwunauthorizedex INTO DATA(lo_unauthorized). MESSAGE lo_unauthorized->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_unauthorized. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 CreateRestApi를 참조하세요.
-
다음 코드 예시는 DeleteRestApi의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. lo_agw->deleterestapi( iv_restapiid = iv_rest_api_id ). MESSAGE 'REST API deleted successfully' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 DeleteRestApi를 참조하세요.
-
다음 코드 예시는 GetResources의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->getresources( iv_restapiid = iv_rest_api_id ). DATA(lt_resources) = oo_result->get_items( ). DATA(lv_count) = lines( lt_resources ). MESSAGE 'Found ' && lv_count && ' resources' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 GetResources를 참조하세요.
-
다음 코드 예시는 GetRestApis의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->getrestapis( ). DATA(lt_apis) = oo_result->get_items( ). DATA(lv_count) = lines( lt_apis ). MESSAGE 'Found ' && lv_count && ' REST APIs' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 SDK for SAP ABAP API 참조의 GetRestApis를 참조하세요. AWS
-
다음 코드 예시는 PutIntegration의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->putintegration( iv_restapiid = iv_rest_api_id iv_resourceid = iv_resource_id iv_httpmethod = iv_http_method iv_type = 'AWS_PROXY' iv_integrationhttpmethod = 'POST' iv_uri = iv_integration_uri ). MESSAGE 'Integration configured for method' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 PutIntegration을 참조하세요.
-
다음 코드 예시는 PutIntegrationResponse의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->putintegrationresponse( iv_restapiid = iv_rest_api_id iv_resourceid = iv_resource_id iv_httpmethod = iv_http_method iv_statuscode = '200' ). MESSAGE 'Integration response configured for status 200' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 PutIntegrationResponse를 참조하세요.
-
다음 코드 예시는 PutMethod의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->putmethod( iv_restapiid = iv_rest_api_id iv_resourceid = iv_resource_id iv_httpmethod = iv_http_method iv_authorizationtype = 'NONE' ). MESSAGE 'Method ' && iv_http_method && ' added to resource' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 PutMethod를 참조하세요.
-
다음 코드 예시는 PutMethodResponse의 사용 방법을 보여 줍니다.
- SDK for SAP ABAP API
-
참고
GitHub에 더 많은 내용이 있습니다. AWS 코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. TRY. oo_result = lo_agw->putmethodresponse( iv_restapiid = iv_rest_api_id iv_resourceid = iv_resource_id iv_httpmethod = iv_http_method iv_statuscode = '200' ). MESSAGE 'Method response configured for status 200' TYPE 'I'. CATCH /aws1/cx_agwbadrequestex INTO DATA(lo_bad_request). MESSAGE lo_bad_request->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_bad_request. CATCH /aws1/cx_agwnotfoundexception INTO DATA(lo_not_found). MESSAGE lo_not_found->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_not_found. CATCH /aws1/cx_agwtoomanyrequestsex INTO DATA(lo_too_many). MESSAGE lo_too_many->get_text( ) TYPE 'I'. RAISE EXCEPTION lo_too_many. ENDTRY.-
API 세부 정보는 AWS SDK for SAP ABAP API 참조의 PutMethodResponse를 참조하세요.
-