404 NotFound while accessing Apis

Highlighted
Regular Contributor

404 NotFound while accessing Apis

it looks like am now able to generate the right x-pay-token

Here comes Mr 404

error even when the url returns a response over the browser

av gone through a couple of other forums and it looks like

and X correlation id

 

Kindly advise Me

Thanks as Usual

7 REPLIES 7
Highlighted
Visa Dev Moderator

Re: 404 NotFound while accessing Apis

Hi @ezamarichard

 

I see that you have posted couple other inquiries for 404 error you have received. Please provide the information on this post - https://community.developer.visa.com/t5/Getting-Started-with-Visa/Success-With-Non-x-pay-token-Api-c...

 

Thank you, 

Vaibhav 

Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.
Highlighted
Regular Visitor

Re: 404 NotFound while accessing Apis

I see now that records have to be created via API or programmatically. I just got impression that swagger-server will generate and return mocked entities by itself based on provided swagger spec.

Tutuapp 9Apps Aptoide

Highlighted

Re: 404 NotFound while accessing Apis

hello,
You have to create a REST resource at /api/banks/1 first; otherwise you'll get a 404, since the resource does not exist.

You can programmatically create a REST resource and pre-load it when your server starts, like this:

var swaggerServer = require('swagger-server');
var app = swaggerServer('banks-api.json');

// Create Bank #1
var myBank = new swaggerServer.Resource('/api/banks', 1, {BankId: 1, Name: 'My Bank'});
app.dataStore.save(myBank);

// Start listening on port 8000
app.listen(8000, function() { ... }
Or you can add a POST operation to your /api/banks path, or a PUT operation to your /api/banks/{bankId} path. Then use a tool like Postman to add banks at runtime.

"paths": {
"/api/banks": {
"post": {
"description": "Create a new bank",
"consumes": ["application/json"],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BankViewModel"
}
}
],
"responses": {
"201": {
"description": "Bank created successfully",
"headers": {
"Location": {
"type": "string"
}
}
}
}
},

Download Bluestacks Download TextNow  Download Photomath

Highlighted
Visa Dev Moderator

Re: 404 NotFound while accessing Apis

Hi @elvisfernandes

 

Can you please let me know the endpoint you re trying to access? If you are getting an error possibly x-correlation-id from the response header. 

 

Thank you, 

Vaibhav 

Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.
Highlighted
Newbie

Re: 404 NotFound while accessing Apis

Try using a GET request instead of a POST request. The headers indicate they only allow origin from weedmaps.com in the POST request.

 

Why many people saying IAs coaching delhi is the best option.

Highlighted

Re: 404 NotFound while accessing Apis


@elvisfernandes wrote:

hello,
You have to create a REST resource at /api/banks/1 first; otherwise you'll get a 404, since the resource does not exist.

You can programmatically create a REST resource and pre-load it when your server starts, like this:

var swaggerServer = require('swagger-server');
var app = swaggerServer('banks-api.json');

// Create Bank #1
var myBank = new swaggerServer.Resource('/api/banks', 1, {BankId: 1, Name: 'My Bank'});
app.dataStore.save(myBank);

// Start listening on port 8000
app.listen(8000, function() { ... }
Or you can add a POST operation to your /api/banks path, or a PUT operation to your /api/banks/{bankId} path. Then use a tool like Postman to add banks at runtime.

"paths": {
"/api/banks": {
"post": {
"description": "Create a new bank",
"consumes": ["application/json"],
"parameters": [
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/BankViewModel"
}
}
],
"responses": {
"201": {
"description": "Bank created successfully",
"headers": {
"Location": {
"type": "string"
}
}
}
}
},

Download Bluestacks Download TextNow  Download Photomath


I have tried this one but, it's not working please help to find out a solution for this.

Highlighted
Regular Visitor

Re: 404 NotFound while accessing Apis

404 is just the HTTP response code. On top of that, you can provide a response body and/or other headers with a more meaningful error message that developers will see.