Oh also there are php warnings in the logs about the api routes being registered
PHP Notice: register_rest_route was called <strong>incorrectly</strong>. The REST API route definition for <code>supportcandy/v1/priorities/(?P<id>\d+)</code> is missing the required <code>permission_callback</code> argument. For REST API routes that are intended to be public, use <code>__return_true</code> as the permission callback. Please see <a href="https://wordpress.org/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.5.0.) in /opt/bitnami/nginx/html/support/wp-includes/functions.php on line 5768
Hello,
Thank you for reporting the wpsc issue. The wpsc is added in /tickets/addRegisteredUserTicket API. Please use it as follows:
https://yourdomain.com/wp-json/supportcandy/v1/tickets/addRegisteredUserTicket?auth_user=AUTH_USER&auth_token=AUTH_TOKEN&fields_data={“FIELD1_SLUG”:”FIELD1_VALUE”,”FIELD2_SLUG”:”FIELD2_VALUE”}
Please use /tickets/attachRegisteredUserFile API to upload the file. It will return you the attachment_id. Use that attachment_id in /tickets/addRegisteredUserTicket API.
We have checked the /priorities/{id} API on the local server and it is working fine. Can you please share the URL you are trying?
Hey Nikhil,
Thanks for the response!
In regard to the postman documentation issue, I’m just letting you know there are a few urls that show as followed
https://yourdomain.com/wpsc/wp-json/supportcandy/v1/…..
However the /wpsc/ in the url to call the api returns a 404 if I do use the following it works ok
https://yourdomain.com/wp-json/supportcandy/v1/…..
having the /wpsc is the url in the docs was somewhat confusing at first.
—————
Can you explain a bit more in detail on the file upload I don’t see an attachment id field in the json body when getting the ticket details by id. are the file uploads done via the threads?
———————–
It might be working fine but is polluting the debug, for the php notices if you enable the following in the wp config
define( ‘WP_DEBUG’, true);
define( ‘WP_DEBUG_LOG’, true );
after navigating around the wordpress site look in /wp-content/debug.log and you will see the php notices
I cannot provide a specific url cause the installation is behind a login.
Hello,
As you want to upload a file while creating a ticket. So please use /tickets/attachRegisteredUserFile API to upload the file. It will return you the attachment_id. Response is like,
{
“status”: 200,
“attachment_id”: 292
}
Use that attachment_id in /tickets/addRegisteredUserTicket API.
Thank you for reporting php notices. They will be fixed in future versions.
Hey Nikhil,
Thank you for the information I’ll give it a try.
Sorry couple more questions:
on the login endpoint is there a session duration for the returned credentials or do they live forever?
—————
Is it possible to add custom custom fields with a hook or something similar? we have a json object that we are attaching to tickets but would like to be able to display and edit that information in a more user friendly way.
Hello,
When you log in using login API. It returns a token. The token does not expire. It lives forever.
Unfortunately, it is not possible to add a custom field using any hook. You have to create it from the settings.