404 error encountered when attempting to access the Swagger UI REST URL with the suffix (.json)

I launched a trial Grape REST API and now I'm attempting to test it using Swagger UI.

The issue arises when Swagger UI loads the API specification by adding parentheses to the suffix:

Unfortunately, this results in a 404 error because the (.json) suffix is not recognized.

The correct URL should appear like this:

Or alternatively:

Any suggestions on how I can resolve this?

Access my Swagger UI setup here

Some valid routes include:

Answer №1

Recently, I faced a similar issue. The problem arose due to the fact that the original API specification data generated by the grape-swagger gem included the "(.json)" suffix.

{
  apiVersion: "0.1",
  swaggerVersion: "1.2",
  resourcePath: "/hotels",
  produces: [
  "application/json"
  ],
  apis: [
  {
    path: "/hotels.{format}",
    operations: [

  ...

To resolve this, there is a configuration option called hide_format in the add_swagger_documentation, which can be used to hide the format suffix. However, it seems like the latest version of grape-swagger (0.10.1) with the most recent version of grape (0.12.0) still has some issues with the hide_format option.

To address this, we need to use a custom development version of grape-swagger and then implement the hide_format setting.

In your Gemfile:

gem 'grape-swagger', github: "tim-vandecasteele/grape-swagger"

In your root API:

add_swagger_documentation hide_format: true

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Slow JSON Processing Speed with SwiftyJSON

I have integrated a large JSON file (500kb) using SwiftyJSON.swift library. It's actually a gpx-file from Strava that I imported successfully. However, the code snippet below is performing very slow, only processing one integration per second. Why is ...

Transform the JSON output from a REST API into a table format for integration into Power BI

After transforming the JSON output into a table in Power BI, I encountered a challenge. https://i.stack.imgur.com/UvOHq.png Despite my efforts, I couldn't figure out how to convert the above format into the desired one in Power BI. If anyone has su ...

Performing an Ajax post request to a PHP script in order to retrieve a PHP variable using XMLHttpRequest

I am looking to dynamically update my table using JavaScript every few seconds. Currently, I have set up an AJAX post request to my update.php file and trigger it if it is set. Then, I execute a MySQL query to retrieve the data and store the resultset in ...

Exploring collapsible data tables in Angular with Bootstrap styling

I am attempting to transform my static bootstrap data table, which displays the total count of fruits harvested in various months in an incremental manner, into a dynamic one using the JSON provided below: JSON { "fruit": [ { "fruitName": "Al ...

Transferring information in JSON format from an API to a JavaScript variable

Hi there, I'm new to json/javascript so your patience is appreciated. I am receiving json data from an API URL that looks like this: { "employees": [ { "firstName":"John" , "lastName":"Doe" }, { "firstName":"Anna" , "lastName":"Smith" }, { "firstN ...

Encountering a "Raphael is undefined" error message when working with Treant.js

I need help creating an organizational flow chart using treant.js. Below is my code snippet, but I'm encountering a 'Raphael is not defined' error that I can't seem to solve. Can someone please assist me with identifying the root cause ...

"Encountering a Bad Request Error When Setting Up Power Automate Flow for SharePoint List and Azure DevOps Work Item Integration due to an

I have set up a Power Automate flow to track modifications made on a SharePoint List: https://i.stack.imgur.com/jMDbA.png Here is the response body I receive from the wiql query: https://i.stack.imgur.com/mlWtn.png In order to update the work item if i ...

Unable to upload a JSON file to MongoDB

While using RockMongo in Openshift to import a json file into a MongoDB database, I came across an issue. The json was exported directly from another MongoDB without any modifications. Here is a snippet of the json data: { "_id" : "10352", "author" : "89 ...

Collecting all the <td> elements within a single row

I am having trouble creating a table dynamically using JSON data. The issue is that all <td> elements are being placed in the same <tr> instead of two separate rows. Here is my JavaScript code: $('button').click(function() { var str ...

Export a SQLite table with a JSON column without the need for double escaping characters

Consider a SQLite table created as follows: create table t(id, j json); insert into t values (1, '{"name": "bob"}'); insert into t values (2, '{"name": "alice", "age":20, "hobbies": ...

Empty results returned by iOS AFJSONRequestOperation

When attempting to fetch data via a JSON request using AFJSONRequestOperation, I encounter an issue where I am able to retrieve the data successfully but unable to seamlessly proceed with the request and pass on the data for further processing. Below is t ...

What is the best way to retrieve the Json data in React Native as indicated in the following example?

The data in JSON format follows a specific pattern. This JSON data is received from the backend through an API call and stored in a state variable. { "message": "user created successfully", "status": "success", "student": { "class": "1 ...

Exploring JSON arrays with HiveSQL

In my Hive table, I am working with data generated from reading a Sequence File in the HDFS. These sequence files are formatted as JSON and resemble the following: {"Activity":"Started","CustomerName":"CustomerName3","DeviceID":"StationRoboter","OrderID ...

Minimize the memory footprint of this Pandas script when loading a JSON file and saving it as a pickle

I'm having trouble trying to further optimize memory usage for my program. Essentially, I am parsing JSON log files into a pandas dataframe but encountering the following challenges: The append function is causing substantial memory consumption as i ...

Using Python to display data stored in a JSON object's "key" field

I've run into a bit of an issue with my scraping code: import urllib import re import json htmltext = urllib.urlopen("http://dx.com/p/GetProductInfoRealTime?skus=48616") htmltext = json.load(htmltext) print htmltext The output looks like this: { ...

Insert a new element into a JSON array using C#

I have a JSON Array here and I am looking to append a new field into the array. However, I am unsure of how to iterate over it. { "data": { "pasca": [ { "code": "PDI1231", ...

REST API Express - DELETE Endpoint

I'm facing an issue with the delete functionality in my API. In order to use my application, a user must log in and then they can add courses. These courses are stored in a nested array within the User model. I want users to be able to remove (delete) ...

What is the best way to display several values on a single line using `jq`?

After parsing through my json data, I've come across the following structure: { "Items": [ { "id": { "S": "c921e4eb-5958-424a-ae3a-b9cada0d9481" }, ...

Simple steps to load various json files into separate json objects using node.js

I am new to working with Json and node.js My goal is to load a json file into a JsonObject using node.js, but I have been struggling to accomplish this task. I have created two files, one named server.js and the other jsonresponse.json. My objective is t ...

Dropdown menu not populating with options in AngularJS ngOptions

It's puzzling to me why the dropdown menu is not being populated by ng-options. Despite JSON data being returned from the service and successfully logged in the controller, ng-options seems to be failing at its task. <tr class="info"> <td ...