How can I delete a record from a custom grid / table using the REST API? - acumatica

I don't see any examples in the Acumatica help or in the training on how to actually remove / delete a record from a custom screen / table using the REST (Contract-based) API. How would one go about doing this? Is it a PUT with different syntax? I did see a Stack Overflow case on deleting detail records - I tried this method and it didn't work for me.
Acumatica REST API - Delete SalesOrderDetail
That also refers to a header/detail setup, which I don't have (only grid details). Any help would be appreciated. Thanks...

You can simply send a DELETE request with the id or the key of your record. That will result in the deletion of the specified record.
curl --location --request DELETE 'https://ACUMATICA_URL/entity/Default/20.200.001/ShippingBox/d9ec53fa-b454-4cf0-b398-817b3b1a84aa'
curl --location --request DELETE
'http://<Base endpoint URL>/entity/Default/20.200.001/ShippingBox/TEST'
You can find more information at the following links:
Remove a Record by Key Fields
Remove a Record by ID

Related

Clear complete Table for custom entity via App?

Is it possible to clear the complete table via an App through the API for a custom entity?
I tried a DELETE but get an error message: Method Not Allowed (Allow: GET, POST)
The documentation states, that its not needed to set the permission in the xml for the own entity. And I can see that also the delete permission is set when looking at the permissions from the App.
How can I achieve this?
Thanks,
Danny
You can use the sync endpoint to mass-delete records but you will still need the ids for all the records to be deleted. There is no way to truncate a table via the api if that is what you're looking for.

Maximo- Update work order using RESTApi by passing wonum and siteid instead of workorderid

We are currently on Maximo 7.6.1 and have started to use Restful APIs and was wondering if there is a way to update a work order using RESTApi by passing wonum and siteid instead of workorderid.
We would like to avoid one additional GET call for our middleware to retrieve the workorderid and then use it in the PUT request.
Using this URL (OS as well) tries to insert a record even though the HTTP method is PUT.
/maxrest/rest/mbo/WORKORDER?_action=AddChange&siteid=XXX&wonum=7065644&description=Testing
Any pointers will be helpful.
Thanks
The IBM documentation appears to suggest you can only update existing records with the unique ID:
Use the PUT method to update or insert a resource. An update request
must provide the unique ID of the resource. To update an object
structure resource, the ID of the main object is required.
https://www.ibm.com/support/knowledgecenter/en/SSLKT6_7.6.0/com.ibm.mif.doc/gp_intfrmwk/rest_api/r_rest_put_method.html
The response received using the url you provided appears to bear this out in as far as it indicates the work order cannot be created as it already exists:
Error 400: BMXAA4129E - The record for Site=BEDFORD, Work Order=1234
already exists. Ensure that the key value for the given record is
unique.
Reviewing the information at the following url I wasn't able to determine a method to perform the update without the unique ID:
https://www.ibm.com/developerworks/community/wikis/form/anonymous/api/wiki/02db2a84-fc66-4667-b760-54e495526ec1/page/87348f89-b8b4-4c4a-94bd-ecbe1e4e8857/attachment/0a884bde-d17e-471b-b046-7f8feddfd267/media/MaximoNextGenRESTAPI%20%281%29.pdf
In addition the Maximo RESTful API Swagger documentation indicates a POST to /os/mxwo is used to "Create a new resource":
/maximo/oas3/api.html?includeactions=1#/Work_Order_Definition_(MXWO)/post_os_mxwo
Whilst a POST to /os/mxwo/{id} is used to "Update WORKORDER Object":
/maximo/oas3/api.html?includeactions=1#/Work_Order_Definition_(MXWO)/post_os_mxwo__id_
I was however able to update an existing work order using the unique ID. This being the case I can only suggest one of the following:
If you're creating the work order first using the REST/OSLC API,
retrieve and store the unique ID from the response received when the
record is created.
If (1) above is not possible, perform a GET and use parameters in
the query to filter on wonum and siteid and only receive back the minimum of
fields (e.g. workorderid only).
If neither (1) or (2) are feasible investigate whether it's possible
to customise Maximo and create your own endpoint for the work order
object structure that takes wonum and siteid as parameters,
retrieves the mbo and performs the update.

Query using SharePoint REST API using Author/EMail

I running into an issue with filtering using the Autor/EMail field in REST API. The query works fine when the List in Not Throttled. But we get Throttling exception when the List is throttled (>5000). The Created By Column is Indexed was well.
https://example.org/sites/dev/rnd/_api/web/lists/getbytitle('Favs')/items?$Select=ID,ItemId,ListName,Author/EMail&$Expand=Author&$Filter=Author/EMail eq 'john.smith#org.com'
After couple of trial and error I found that Author/Email is not the correct field to use. Instead we need to use Author/Id. The Id would the site user id and we can get the value from the property _spPageContextInfo.userId
Hope this helps somebody.

How Instagram Real Time Subscription works

I am following this link Instagram Real time updates tag - getting empty data, why? to implement Instagram Real Time Subscription.
I am thinking do I need to hit the url every time in order to check the new update, how is gonna work?. Some are using nodejs, socketio,etc, which I dont want to get into this.
What I am trying to achieve through this that every time is a new update, It starts getting analytic automatically without letting my system know which image to mointor.(I already implemented this part), but stuck on the real time.
Any suggestion to that.
You don't need socketio.
https://instagram.com/developer/realtime/?hl=en
You subscribe to something passing an url that will be used for answers
Everytime there is an update instagram will send you a payload to the url you passed during your subscription.
The point of subscription: You create a subscription (you'll give some parameters, client_id, client_secret and the url you want instagram to call when there is an update, check the documentation for details).
curl -F 'client_id=CLIENT-ID' \
-F 'client_secret=CLIENT-SECRET' \
-F 'object=user' \
-F 'aspect=media' \
-F 'verify_token=myVerifyToken' \
-F 'callback_url=http://YOUR-CALLBACK/URL' \
https://api.instagram.com/v1/subscriptions/
Each time the media you subscribed to is updated instagram will send you new data to the urlcallback you provided in the subscription.
I hope it helps you to understand how it works. Read the documentation throghroughly.
you NEED to read the documentation =D From the documentation:
"When someone posts a new photo and it triggers an update of one of your subscriptions, we make a POST request to the callback URL that you defined in the subscription".

Add special via foursquare api, got code 200 but special doesn't show up

I am trying to add a special via the foursquare api Add special endpoint.
I am generating a proper POST request and getting a similar response to what the api should return. But it still wont show up on the specials on foursquare.
Do I need to add a campaign too for it to show up?
This is the response object I am getting:
{"meta":{"code":200},"notifications":[{"type":"notificationTray","item":{"unreadCount":0}}],"response":{"special":{"id":"51ed8c2a498e821be0469850","type":"friends","status":"New
- in review","count1":10,"name":"Friends Special...!","text":"Everyone gets free cookies??","unlockedText":"hgc","autoRedeem":false}}}
Any ideas on what needs to be done?
PS: I am able to add a special manually on foursquare!!
This venue is an office and according to this api doc offices and homes aren't allowed to add specials. This is a bit of a conflict.
Is it that offices are not allowed to add specials only via the API since I am able to create a special manually on foursquare.
Alright so, got the answer.. Create a special then create a campaign works!!
But I'm still wondering how I was able to add a special when the documentation clearly says that homes and offices aren't allowed to do so!

Resources