apigee / apigee-smartdocs-maven-plugin

Apache License 2.0
11 stars 10 forks source link

HTTP 415 error while running the sample for Drupal8 #13

Closed nagashreeb closed 4 years ago

nagashreeb commented 5 years ago

mvn install "-Pdev" "-Dportal.username=xxxx" "-Dportal.password=xxx" "-Dapigee.smartdocs.config.options=create" "-Dportal.url=http://xxx/ApigeeDevPortal/web"

[ERROR] Failed to execute goal com.apigee.smartdocs.config:apigee-smartdocs-maven-plugin:2.0.0:apidoc (smartdocs-deploy) on project DeveloperPortal: Execution smartdocs-deploy of goal com.apigee.smartdocs.config:apigee-smartdocs-maven-plugin:2.0.0:apidoc failed: Update failure: 415 Unsupported Media Type [ERROR] {"jsonapi":{"version":"1.0","meta":{"links":{"self":{"href":"http:\/\/jsonapi.org\/format\/1.0\/"}}}},"errors":[{"title":"Unsupported Media Type","status":"415","detail":"No route found that matches \u0022Content-Type: application\/vnd.api+json, application\/vnd.api+json\u0022","links":{"via":{"href":"http:\/\/xxxx\/ApigeeDevPortal\/web\/jsonapi\/apidoc\/apidoc"},"info":{"href":"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html#sec10.4.16"}}}]}

I have tried accessing this http://xxxx/ApigeeDevPortal/web/jsonapi/apidoc/apidoc through postman with Accept header set to application/vnd.api+json, the endpoint returns a HTTP 200 with the json content smartdocs-maven-execution-debug-log.txt

ssvaidyanathan commented 5 years ago

@nagashreeb Can you try with the portal.url with just the Drupal 8 host mvn install -Pdev -Dportal.username=xxxx -Dportal.password=xxx -Dapigee.smartdocs.config.options=create -Dportal.url=http://xxx

ssvaidyanathan commented 5 years ago

@nagashreeb - Did you update the module ? as the plugin needs the latest update

nagashreeb commented 5 years ago

That gives a http 404 [INFO] --- apigee-smartdocs-maven-plugin:2.0.0:apidoc (smartdocs-deploy) @ DeveloperPortal --- [INFO] **** [INFO] API Docs [INFO] **** [INFO] Get OpenAPI Specs from ./specs [INFO] Getting API doc for * Tenant HTTP API [INFO] Retrieving ** Tenant HTTP API doc. [ERROR] 404 Not Found <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE

nagashreeb commented 5 years ago

@nagashreeb - Did you update the module ? as the plugin needs the latest update

Yes I did update the module. [Server is in UTC time settings] api-catalog-update

ssvaidyanathan commented 5 years ago

Can you try this API documented here (https://www.drupal.org/docs/8/modules/apigee-api-catalog/expose-rest-apis-to-interact-with-api-docs#s-fetch-api-docs) If you get that to work. What ever you replace kickstart.local is what you will pass for the portal.url property in the maven command

nagashreeb commented 5 years ago

Can you try this API documented here (https://www.drupal.org/docs/8/modules/apigee-api-catalog/expose-rest-apis-to-interact-with-api-docs#s-fetch-api-docs) If you get that to work. What ever you replace kickstart.local is what you will pass for the portal.url property in the maven command

Yes that works from postman, and when I use the same value as in the postman URL for portal.url, I encounter a HTTP 415. apidocs-restapi-drupal8 If you look at the maven execution log that I atatched in my initial post, the 415 issue occurs while creating the Spec. Retrieving and importing the spec get executed successfully. [INFO] Get OpenAPI Specs from ./specs [INFO] Getting API doc for xxxx Tenant HTTP API [INFO] Retrieving xxxx Tenant HTTP API doc. [INFO] API Doc: xxxx Tenant HTTP API does not exist [INFO] Importing spec.. [INFO] Spec import complete.. [INFO] API Doc uuid:895006fd-97fa-4f1b-9839-96d3c0a6d7d8 [INFO] Creating spec..895006fd-97fa-4f1b-9839-96d3c0a6d7d8 [ERROR] 415 Unsupported Media Type

nagashreeb commented 5 years ago

I can also see that in the portal the file is imported but not attached to the API doc to be published since the Create spec operation failed. api-doc-upload

ssvaidyanathan commented 5 years ago

Can you run with -X and see if the debug logs have more info ? What is your email id ? If you have mine, please email me

nagashreeb commented 5 years ago

Can you run with -X and see if the debug logs have more info ? What is your email id ? If you have mine, please email me

I have your email id, i will send it out to you.

arunz6161 commented 5 years ago

I noticed the same error when using curl but in my case, i had the POST url incorrect- it should be https://kickstart.local/jsonapi/apidoc/apidoc/spec but i was missing spec. From the debug logs attached, i see indications of the same issue

{"jsonapi":{"version":"1.0","meta":{"links":{"self":{"href":"http:\/\/jsonapi.org\/format\/1.0\/"}}}},"errors":[{"title":"Unsupported Media Type","status":"415","detail":"No route found that matches \u0022Content-Type: application\/vnd.api+json, application\/vnd.api+json\u0022","links":{"via":{"href":"http:\/\/**\/ApigeeDevPortal\/web\/jsonapi\/apidoc\/apidoc"},**

nagashreeb commented 5 years ago

I noticed the same error when using curl but in my case, i had the POST url incorrect- it should be https://kickstart.local/jsonapi/apidoc/apidoc/spec but i was missing spec. From the debug logs attached, i see indications of the same issue

{"jsonapi":{"version":"1.0","meta":{"links":{"self":{"href":"http://jsonapi.org/format/1.0/"}}}},"errors":[{"title":"Unsupported Media Type","status":"415","detail":"No route found that matches \u0022Content-Type: application/vnd.api+json, application/vnd.api+json\u0022","links":{"via":{"href":"http://**/ApigeeDevPortal/web/jsonapi/apidoc/apidoc"},**

@arunz6161 - that's the log message coming from the maven plugin execution, is there something i can do to override it and provide the link during the maven execution?

ssvaidyanathan commented 4 years ago

v2.0.1 should have this fix