1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    8
    Answers
    1
    Vote Rating
    0
    G_D is on a distinguished road

      0  

    Question Unanswered: RestProxy: Remove id in POST request URL

    Unanswered: RestProxy: Remove id in POST request URL


    Hi everybody,

    I'm having a problem posting new elements to a REST web service.
    The web service can be reached under /exercise and is used to catalogue excercises.
    Here the model:
    Code:
    Ext.regModel('Exercise', {
        proxy : {
            type : 'rest',
            url : 'http://localhost:8080/exercises',
        },
        fields : [
        {
            name : 'class',
            type : 'string'
        },{
            name : 'id',
            type : 'int'
        },{
            name : 'name',
            type : 'string'
        }, {
            name : 'description',
            type : 'string'
        }, {
            name : 'version',
            type : 'int'
        }]
    });
    and here the code for creating a new Object
    Code:
    newExercise = Ext.ModelMgr.create({
                name : 'Chin Up',
                description: 'Tuff stuff',
            }, 'Exercise');
            
    newEx.save();
    Since the webservice manages the asignement of ids to new objects the web service expects a post to look like this
    Code:
    POST /exercise/?_dc=...
    instead an id is added to the POST request, which causes the web servide to reply an error message.
    Code:
    POST /exercise/0?_dc=...
    Can I do anything about it?

    Thank you in advance

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,795
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you really need to use rest then? Maybe just ajax?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    8
    Answers
    1
    Vote Rating
    0
    G_D is on a distinguished road

      0  

    Default


    Well it's a fallback solution of course but it would be nice to use the restproxy.
    So deducting from your answer I have to overwrite the URL myself by extending the RestProxy?

    I guess it would be a nice improvement for a future release:
    Code:
    new Ext.data.RestProxy({    url:'/users',    appendIdToPost:true});
    Last edited by G_D; 3 Feb 2012 at 9:28 AM. Reason: error in the code section

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi