1

I have setup the Geode rest API and can run get and queries, via Chrome, on a region for example:

http://localhost:8080/gemfire-api/v1/items

When I try and delete entries in a region according to Developing REST Applications by using the following endpoint:

DELETE /gemfire-api/v1/{region}

For example:

http://localhost:7070/gemfire-api/v1/items

Can you tell me how to run the example in Chrome, and delete the entries please? I simply want to be able to run

http://localhost:8080/gemfire-api/v1/items/delete

but instead I am getting

{"cause":"Key (delete) does not exist for region (items) in cache!"}

Pac0
  • 21,465
  • 8
  • 65
  • 74
rupweb
  • 3,052
  • 1
  • 30
  • 57

2 Answers2

1

You are going to need to use ajax. The DELETE is talking about the HTTP verb you need and not that you need to add it to the URL.

Have your delete function execute this code:

$.ajax({
    url: 'http://localhost:7070/gemfire-api/v1/items,
    type: 'DELETE',
    data: {item:item}, //<-----this should have to be an object of your item type.
    contentType:'application/json', 
    dataType: 'text',                
    success: function(result) {...}, // <---update this with a callback
    error: function(result){...}// <---update this with a callback
});
Billy Ferguson
  • 1,429
  • 11
  • 23
1

Via the browser Chrome you can use an extension like Postman

It will allow you to send request with any verb, so you could simply test the request before using them within whatever you do, your website for example)

GET (like when you simply type the url in the browser and hit Enter)

POST (like when you submit a form)

DELETE (the one you want)

PUT (another verb widely used usually for update an existing object)

Illustration for use : enter image description here

Pac0
  • 21,465
  • 8
  • 65
  • 74