Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8991127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:39:17+00:00 2026-06-15T22:39:17+00:00

I have a backbone script that calls a Slim REST service. GET requests are

  • 0

I have a backbone script that calls a Slim REST service. GET requests are working fine, PUT requests are returning 404 Not Found. Note: this was working until my code was recently moved to a different server (and it works locally), so I’m guessing it has something to do with an Apache config setting. Here’s a snippet of the backbone script:

jQuery(document).ready(function ($) {

    //define box model
    var Box = Backbone.Model.extend({
        url: function () {
            var urlId = (this.id) ? this.id : "";
            var myUrl = "/wp-includes/api/service.php/box/" + urlId;
            return myUrl;   
        }
    });

        var BoxView = Backbone.View.extend({
        tagName: "div",
        template: $("#boxTemplate").html(),

        initialize: function () {
            this.model = new Box(box);
            this.render();
        },

        saveBox: function(e){
            e.preventDefault();
            $("#boxMessage").empty();
            var formData = {},
                prev = this.model.previousAttributes();

            $(e.target).closest("form").find(":input").not("button").each(function (){          
                var el = $(this);
                formData[el.attr("id")] = el.val();
            });

            this.model.set(formData);
            this.model.save(
                { },
                {
                    success: function() {
                        $("#boxMessage").html("Box information saved.");
                    },
                    error: function() {

                    }
                }
            );
        }

Here’s a snippet of the Slim REST service:

<?php

require 'Slim/Slim.php';

$app = new Slim();

$app->get('/workouts/:id',  'getWorkout');
$app->put('/box/:id', 'updateEventBox');

$app->run();

function getWorkout($id) {
    echo json_encode(GetEventCompetitorWorkout($id));
}

function updateEventBox($id) {
    $request = Slim::getInstance()->request();
    $body = $request->getBody();
    $eventBox = new EventBox(null);
    $eventBox->TakeJson($body);
    $eventBox->Save();
}

And here’s the header info for the request:

Request URL:http://www.mydomain.com/wp-includes/api/service.php/box/1
Request Method:PUT
Status Code:404 Not Found

UPDATE: just tested a POST to the same service and it worked fine. PUT still fails.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T22:39:18+00:00Added an answer on June 15, 2026 at 10:39 pm

    I’ve found it not too uncommon that some servers only have GET,POST,HEAD enabled and that PUT,DELETE which are needed for REST are not enabled. That could be the case.

    To test for this you can tell Backbone to use “emulatated HTTP” by calling this before your code:

    Backbone.emulateHTTP = true;
    

    This will make backbone use only GET/POST requests however it will append to the querystring “_method=PUT” or “_method=DELETE” which you can use on the serverside to detect the intended HTTP verb.

    So on the server side you need to do something like this like as the first line of your index.php file (before any of the framework loads):

    if (isset($_REQUEST['_method'])) $_SERVER['REQUEST_METHOD'] = $_REQUEST['_method'];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have dowloaded backbone.js from http://documentcloud.github.com/backbone/ , included that file inside script tag and
I have Backbone.js collection that holds (for example) 30 items. I want to pass
I have backbone view that binds an action to an element in the DOM.
I have a Backbone.js application that allows users to create graphs based on large
We have a backbone.js app that displays a number of forms to the user.
I have a Backbone View that has a Collection as its Model. If the
Assume that I have a backbone model that has a bunch of boolean attributes:
I'm working with backbone+requirejs+jquery and I have a problem with jquery plugin loading in
I have a collection ( using the Backbone.paginator ) that fetchs a array of
I am using underscore.js's templating capabilities from backbone.js, I have the following template that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.