viggnah
viggnah

Reputation: 1879

WSO2 APIM: Calling service APIs through cURL gives no response

I'm using APIM 4.1.0. I am following this and another tutorial to create an API through publisher service API. After generating the access token I use the below command but there is no response. No error code even. Are these URLs correct?

curl -k -H "Authorization: Bearer <access-token>" -H "Content-Type: application/json" -X POST -d @data.json https://127.0.0.1:9443/api/am/publisher/v2/apis

data.json file contains:

{
    "policies": [
        "Unlimited"
    ],
    "visibility": "PUBLIC",
    "visibleRoles": [],
    "visibleTenants": [],
    "cacheTimeout": 300,
    "endpointConfig": {
        "endpoint_type": "http",
        "sandbox_endpoints": {
            "url": "http://maps.google.com/maps/api/directions/"
        },
        "production_endpoints": {
            "url": "http://maps.google.com/maps/api/directions/"
        }
    },
    "subscriptionAvailability": null,
    "subscriptionAvailableTenants": [],
    "operations": [
        {
            "id": "postapiresource",
            "target": "string",
            "verb": "POST",
            "authType": "string",
            "throttlingPolicy": "Unlimited",
            "scopes": [
                "apim:api_view"
            ],
            "usedProductIds": [
                "string"
            ]
        }
    ],
    "responseCachingEnabled": false,
    "isDefaultVersion": true,
    "businessInformation": {
        "technicalOwner": "ApiCreator",
        "technicalOwnerEmail": "[email protected]",
        "businessOwner": "ApiPublisher",
        "businessOwnerEmail": "[email protected]"
    },
    "transport": [
        "http",
        "https"
    ],
    "tags": [
        "phone",
        "multimedia",
        "mobile"
    ],
    "provider": "admin",
    "version": "Beta",
    "description": "Calculates directions between locations",
    "name": "GoogleDirectionsAPI",
    "context": "/googledirections"
}

Upvotes: 0

Views: 126

Answers (1)

Pubci
Pubci

Reputation: 4001

You have to use v3 version as follows.

curl -k -H "Authorization: Bearer <access-token>" -H "Content-Type: application/json" -X POST -d @data.json https://127.0.0.1:9443/api/am/publisher/v3/apis

Upvotes: 1

Related Questions