• Resolved msowah

    (@msowah)


    What are the methods for the various rest api? Looks like all are GET or am missing something?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Dylan James

    (@dylanjkotze)

    Hi there,

    Thanks for the question.

    You can find all the available methods from here:

    https://zephyr-one.com/rest-api/

    Regarding all the methods being GET, this was something that was done for compatibility with the older versions of the mobile app, but I have updated this now.

    I hope this helps.

    Kindest regards,
    Dylan

    Thread Starter msowah

    (@msowah)

    Great, I’ve seen the updates on the API being GET/POST now.

    Can I call some of the functions in your REST API class in my themes function.php not the rest API call but a function in the API class?
    if yes am example please…

    Thank you.

    • This reply was modified 2 years, 7 months ago by msowah.
    Plugin Author Dylan James

    (@dylanjkotze)

    Hi,

    Great, thanks.

    Just to confirm, do you mean via using the plugin PHP classes instead of the REST API calls?
    Yes, this can be done and to do so, you can add the ‘using’ statement at the top of the functions.php file for the classes you would like to use, and then you can use the functions.
    For example, to get all the tasks, you can add this at the top of the functions.php file:

    using Inc\Core\Tasks;

    And then to get the tasks you can use this function:

    $tasks = Tasks::get_tasks();

    However, it obviously depends on what your requirement is and what you are trying to achieve. If you could give me an overview of what you are trying to achieve, I would be happy to provide you with the functions and classes you will need to achieve it.

    I hope this helps.

    Kindest regards,
    Dylan

    Thread Starter msowah

    (@msowah)

    Hello Dylan,
    Thanks a bunch for your response.
    And Yes, the plugin PHP classes instead of the REST API calls.

    Almost all the functions I need are in your zephyr-project-manager/includes/Api/RestApi.php class RestApi

    So if I could just include that file and call the functions I need in there, I will be good.

    Thank you.

    Best regards,
    Michael

    Plugin Author Dylan James

    (@dylanjkotze)

    Hi Michael,

    Great, thanks.

    That class can be included by adding the following to the top of the file you want to use the functions at:

    using Inc\Api\RestApi;

    I hope this helps.

    Kindest regards,
    Dylan

    Thread Starter msowah

    (@msowah)

    Hello just for clarity is it
    “using Inc\Api\RestApi;” or rather “use Inc\Api\RestApi;”?

    Thanks,

    Best regards,
    Michael

    Plugin Author Dylan James

    (@dylanjkotze)

    Hi Michael,

    Sorry for the mistake on my end.

    It is indeed ‘use Inc\Api\RestApi;’ as you mentioned instead of ‘using’.

    Best regards,
    Dylan

    Plugin Author Dylan James

    (@dylanjkotze)

    Hi Micheal,

    I just wanted to send a message and let you know that the newest updates will require you to change your namespace imports from ‘Inc\’ to ‘ZephyrProjectManager\’ as it has been requested to change this to avoid plugin conflicts.
    So it would be ‘use ZephyrProjectManager\Api\RestApi;’ now.

    Kindest regards,
    Dylan

    Thread Starter msowah

    (@msowah)

    Thank you, Dylan,
    Had a little setback with regard to the PayPal payment for the pro version and the bank transfer option’s charges are quite steep from my side.

    Anyways I noticed there’s no rest API endpoint for activities and reports.

    • This reply was modified 2 years, 6 months ago by msowah.
    Plugin Author Dylan James

    (@dylanjkotze)

    Hi there,

    Sorry to hear about that.

    OK, I would be happy to add that. Before I do, I just wanted to confirm, would you just like the ability to fetch activities or also log activities?

    Thanks.

    Kindest regards,
    Dylan

    Thread Starter msowah

    (@msowah)

    Hello,
    I think having both is not a bad idea at all.

    what about the reports api?

    Thanks

    Plugin Author Dylan James

    (@dylanjkotze)

    Hi Michael,

    Thanks. I have added this functionality now to the REST API, for logging and fetching activities.
    Here is the updated version (which I will be releasing soon as well as an update)
    https://drive.google.com/file/d/1zvVSLr5y_6PsCg5spvWt0IbSUYCgIhN3/view?usp=sharing

    Fetching Activities (Using GET):
    zephyr_project_manager/v1/activity

    Logging Activities (Using POST):
    zephyr_project_manager/v1/activity/log

    Parameters to send when logging activities:
    user_id: The ID of the user that the activity relates to
    message: The activity message
    subject: Either ‘task’ or ‘project’ if it relates to a specific task/project
    subject_id: The task or project ID if the ‘subject’ field is set
    action: The action slug, which isn’t required, but can be used to distinguish activity types/categories. For example task_created or user_logged_in.

    I hope this helps and let me know if you have any questions, and I would be happy to help.

    Kindest regards,
    Dylan

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Rest API methods’ is closed to new replies.