Help get this topic noticed by sharing it on Twitter, Facebook, or email.

consuming a Wix database from my Appery App

Hello,

Is it possible to store all my app data on a Wix database, and be able to perform CRUD operation against that data from my Appery App?

How is this done?

Mike
1 person has
this question
+1
Reply
  • Hello Michael,

    Does it have the REST API? If so - sure, you can connect it with Appery.io API Express REST component: https://docs.appery.io/docs/apiexpres...
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Thanks Serhii. How about using the same wix db for registration and login? The reason I am exploring this path is because Appery offiers such a small amour of disk space... 2 MB... may I send you guys a few 100 TB drives to attach to the Linux server?

    Anyways, I appreciate your efforts, and always providing top quality answers; even when I ask dumb questions.. So thanks

    Mike
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated

  • So, if the Wix Database, cannot be exposed via REST, will my Appery app still be able to perform CRUD operations against the Wix database via XHR ? If yes, how are these calls constructed using either server code or perhaps UI components driven via jQuery?

    Thanks

    Mike
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • Thanks Serhii. I am thinking of using a Wix database using regular HTTP Methods
    : post, get, put, delete, patch.. For example my JS code looks like this:

    my wix endpoint is this: https://www.mywixdomain.com/_function...
    my wix collection is named 'userProfile'

    import {ok, notFound, serverError} from 'wix-http-functions';
    import wixData from 'wix-data';

    export function get_readdata(request) {
    let options = {
    "headers": {
    "Content-Type": "application/json"
    }
    };
    // query a collection to find matching items
    return wixData.query("userProfile")
    .eq("firstName", request.path[0])
    .eq("lastName", request.path[1])
    .find()
    .then( (results) => {
    // matching items were found
    if(results.items.length > 0) {
    options.body = {
    "items": results.items
    };
    return ok(options);
    }
    // no matching items found
    options.body = {
    "error": `'${request.path[0]} ${request.path[1]}' was not found`
    };
    return notFound(options);
    } )
    // something went wrong
    .catch( (error) => {
    options.body = {
    "error": error
    };
    return serverError(options);
    } );
    }

    Note: The server code is easier for me than the API express. I just don;t know how to get data from the response and display it on my form, store it as variable, or run some other login against the response. I am a visual learner: I see code one time and then I can hack it and make it fit all my other needs..

    I know you cant write code. Perhaps you have a sample other users posted; and share it with me.

    Thanks

    Mike
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated

  • I just found this code on wix. Was not sure what it was, so I make some tweaks and asked for your advice.

    I am having problem flowing how api express works. server code makes sense. for example, I am not sure how to use the data returned by an api express service response. How do I know what is being returned, so that I can then run logic to consume the data?

    Mike
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited sad, anxious, confused, frustrated