// @abi action
    void create(name user,string doctor_name,string doctor_contact,string doctor_address,string patient_problem,string patient_description,string patient_solution){

        require_auth( user ); //require auther permission

        record_index datable( _self,_code.value); // Define database object

        datable.emplace( user, [&](report & r){

            r.report_poster = user;
            r.report_id = datable.available_primary_key();
            r.doctor_name = doctor_name;
            r.doctor_contact = doctor_contact;
            r.doctor_address = doctor_address;
            r.patient_problem = patient_problem;
            r.patient_description = patient_description;
            r.patient_solution = patient_solution;
        }); // create data in database

This is the EOSIO action for which I want to create an API. How do I proceed?

  • 3
    What exactly are you trying to do? Which programming language/framework are you using for your server?
    – tmm
    Mar 27, 2019 at 15:06
  • i am using eosjs and node.js Mar 28, 2019 at 5:29
  • Try to make api by nodejs follow this tutorialspoint.com/nodejs/nodejs_restful_api.htm to know about api in nodejs.
    – Mr.Y
    Mar 28, 2019 at 5:34
  • I know that but it did not work Mar 28, 2019 at 5:50
  • It works i have tried
    – Mr.Y
    Mar 28, 2019 at 12:05

1 Answer 1


If you want to run create action through eosjs, then you need to set your active key what you upload contract.

I think the reason why "it did not work" may following causes.

1) no right to run contract action. your contact action have this statement "require_auth( user ); "

2) no proper options for eosjs

3) no proper settings for network

BTW, do you run setabi and setcode for this contract?

anyway, if you upload error statement when you try node.js server, it will be helpful to resolve this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.