Acumatica run report from REST API - acumatica

I need to get accurate inventory numbers via the Acumatica API so that I can update inventory on an external site. Our only method of getting accurate inventory is running a report under Distribution -> Inventory -> Reports Tab then selecting Inventory Balance and running the report without an Inventory ID so I get a full list of all inventory in our system. How can I run this report (or any report) via Acumatica's API? I can use REST or SOAP in this case.
I need the data from the report in a manner that I can consume it in my C# application and use it to update a database on an external site. So for example, if I were using the REST API, I would want a report returned in JSON format. Example desired return below:
{
"InventoryID": {
"value": "CW-500-MC-30"
},
"Warehouse": {
"value": "WH1"
},
"Description": {
"value": "Milk chocolate chews"
},
"Available": {
"value": 8
}
},
{
"InventoryID": {
"value": "AB-100-SE-30"
},
"Warehouse": {
"value": "WH1"
},
"Description": {
"value": "Face lotion"
},
"Available": {
"value": 12
}
}

As mentioned in the Appendix of the I210 course pdf section Generate a printable invoice by invoice ID :
This web integration scenario is not supported in the available versions of system endpoints. If you need to generate reports, you can use the screen-based SOAP API. For details, see the I200 Screen-Based Web Services training course in Acumatica University.
Looking in that course and following the Example 4.3.3: Generating the Printable Version of an Invoice will show how to get a report through the API.
Which can be resumed by putting the following information in the command list sent through the API.
The different parameters that need to be set for the report
A mention to the PDF Content from the Report Result so that the API knows that must return it to you.
After that you only need to use any library capable of writing to your file system in order to create the PDF file with the information you just received.

Related

ADFv2: creating data source with a dynamic authenticated URL

I have a pipeline that uses a Lookup activity with a POST REST service as the source dataset. This Lookup successfully retrieves a string from the body that is then passed as an "access token" inside the header of GET Web activity.
This GET Web activity then returns a set of 3 values inside the body of the return: fileURL, sasToken, fileaccessURL. The "fileaccessURL" is simply a concatenation of "fileURL" and "sasToken"
The new dynamically created "fileaccessurl" points to a ZIP file inside a blob storage housed with my partner company. This ZIP file contains that actual data I want to use as my data source. I am OK with deflating the file once I get it and using the files within as my actual source.
The issue I'm having is how to specify that the dynamically assigned "fileaccessurl" is my data source for getting that initial ZIP file? I can't parameterize REST or HTTP linked services or figure out any other way to set this. I have already eliminated the option of connecting directly to the partner blob storage. I have tried using lookups but I still can't figure out how to specify my destination with a URL that isn't necessarily always the same.
If you are looking for how to parameterize linked service, you can try to use the advanced part and check "specify dynamic content in JSON format".
This is the sample JSON code:
{
"name": "AzureSqlDatabase",
"properties": {
"type": "AzureSqlDatabase",
"typeProperties": {
"connectionString": {
"value": "Server=tcp:myserver.database.windows.net,1433;Database=#{linkedService().DBName};User ID=user;Password=fake;Trusted_Connection=False;Encrypt=True;Connection Timeout=30",
"type": "SecureString"
}
},
"connectVia": null,
"parameters": {
"DBName": {
"type": "String"
}
}
}
}
You can try to modify the code to align with Rest or HTTP linked service payload.

Azure Search, listAdminKeys, ARM output error (does not support http method 'POST')

I am using this bit of code as an output object in my ARM template,
"[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
Full text sample of the output section:
"outputs": {
"SearchServiceAdminKey": {
"type": "string",
"value": "[listAdminKeys(variables('searchServiceId'), '2015-08-19').PrimaryKey]"
},
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2015-08-19')[0]]"
}
I receive the following error during deployment (unfortunately, any error means the template deployment skips output section):
"The requested resource does not support http method 'POST'."
Checking the browser behavior seems to validate the error is related to the function (and, it using POST).
listAdminKeys using POST
How might I avoid this error and retrieve the AzureSearch admin key in the output?
Update: the goal of doing this is to gather all the relevant bits of information to plug into other scripts (.ps1) as parameters, since those resources are provisioned by this template. Would save someone from digging through the portal to copy/paste.
Thank you
You error comes from listQueryKeys, not admin keys.
https://learn.microsoft.com/en-us/rest/api/searchmanagement/adminkeys/get
https://learn.microsoft.com/en-us/rest/api/searchmanagement/querykeys/listbysearchservice
you wont be able to retrive those in the arm template, it can only "emulate" POST calls, not GET
With the latest API version, it's possible to get the query key using this:
"SearchServiceQueryKey": {
"type": "string",
"value": "[listQueryKeys(variables('searchServiceId'), '2020-06-30').value[0].key]"
}

Pass the output of SQL Connector to Custom Api App

I have a logic app which is triggered manually. The first connector is SQL connector which executes a stored proc and retrieves the data (json array). Now I want to pass this as an input to my custom api app. Below is the snap shot of my custom api method signature
After I add my custom api app I get the below screen. How do I pass the output of my SQL connector as an input to my API app?
Additionally I am confused as to why is the UI displaying me individual properties of my Customer class. Isn't it supposed to give me one big box to provide the json array input? I also tried entering static values in the input fields but then the option to save the logic app gets grayed out. I tried assigning the value #body('Execute_stored_procedure')['ResultSets']['Table1'] to the body property of the api app in the code view and even after saving it successfully the value is reset to null when I load the designer again.
Below is the sample response from the SQL connector stored proc
{
"body": {
"OutputParameters": {},
"ReturnCode": 0,
"ResultSets": {
"Table1": [
{
"FirstName": "Karen",
"LastName": "Choi",
"EmailAddress": null,
"PhoneNumber": null,
"PostalCode": "98104",
"City": "Seattle",
"Address": "Hidden",
"StateCode": "Washington"
},
{
"FirstName": "Jeanne",
"LastName": "Blake",
"EmailAddress": null,
"PhoneNumber": null,
"PostalCode": "90012",
"City": "Los Angeles",
"Address": "Hidden",
"StateCode": "California"
}
]
}
PS: I am using the new version of the logic apps. My custom API app used to work perfectly with the old version of the logic app.
EDIT
The logic app prevents me to save if I enter the static values on the UI. In the below image the Save option is disabled
EDIT 2
I found a strange behaviour. If I add a condition to the output of SQL connector I can see all the output properties of the SQL Connector.
Why is it that I can't see the same set of properties when I add my custom connector (Figure 2)?
Could you try to use #body('ResultSets').Table1 instead in the code view ?
Have you tried
#body('theSQLConnectorName').OutputParameters.result (alt. .ResultSet)
?

Docusign API integration - how to send multiple templates and populate values

I have a pretty basic question about how the Docusign API works. I tried finding the answer myself but was quickly overwhelmed by the massive amount of information, much of which is outdated, in the support center.
Here’s what I’m trying to do:
I have uploaded and configured multiple templates in my Docusign account
I am writing a web app which will allow my users to request a subset of those templates based on certain criteria
The subset of templates would then be used in my app via an iframe integration (I'm assuming)
I would also like to automatically populate several of the fields in my new copies of the templates
How do I perform the API request in step 2?
How do I perform the API call in step 3? Or are the values injected into the document some other way?
A totally different approach would be to provision a new Docusign account for each of my users but that didn’t seem right. If someone could just point me in there right direction I would really appreciate it.
It's actually not that basic of a question, I'd say if you were asking how to send a signature request on a document or from one template that's basic but how to combine and send multiple templates and populate values in them is a little more involved.
With that said, to combine multiple templates into signature requests you can simply use the Composite Templates node in your envelope definition. Using composite templates you can combine multiple server-side templates from your account, or combine templates with local documents or documents from other sources (i.e. cloud).
Regarding your Questions:
1]
You can make an API call to programmatically retrieve the templates that are available in your account then display whatever aspects you want about them in your UI, such as name, description, template ID, etc. Once the user (or your app logic) indicates which templates they want to combine into a signature request you can combine them like this (this combines 2 server templates):
{
"emailSubject":"DocuSign Signature Request using Composite Templates",
"status":"sent",
"compositeTemplates":[
{
"serverTemplates":[
{
"sequence":"1",
"templateId":"55A80182-2E9F-435D-9B16-FD1E1C0F9D74"
}
],
"inlineTemplates":[
{
"sequence":"1",
"recipients":{
"signers":[
{
"name":"John Doe",
"email":"firstrecipient#gmail.com",
"recipientId":"1",
"clientUserId":"1001",
"roleName":"RoleOne"
}
]
}
}
]
},
{
"serverTemplates":[
{
"sequence":"2",
"templateId":"44D9E888-3D86-4186-8EE9-7071BC87A0DA"
}
],
"inlineTemplates":[
{
"sequence":"2",
"recipients":{
"signers":[
{
"name":"Jane Doe",
"email":"secondrecipient#gmail.com",
"recipientId":"1",
"clientUserId":"1002",
"roleName":"RoleOne"
}
]
}
}
]
}
]
}
2]
Yes if you want to embed your recipients (which means they sign through your UI and not through the DocuSign website or app) then it is recommended you use an iFrame for Web apps and a Webview for mobile apps. To embed a given recipient you must set their clientUserId as I have for both recipients in the above example. This is a string and is defined on the client-side, you just need to remember which values you use for each recipient as you need that to generate each recipient's signing URL (which you will load in the iFrame).
Have a look at the "Signing from within your app" API Recipe for sample code of how to accomplish this. That sample doesn't use templates to create the envelope but it shows how to generate the unique signing URLs:
Signing from within your app
Or if you want to test with raw API calls (that don't use the DocuSign SDKs) you can use the API Explorer to test these calls:
API Explorer
3]
You basically had a third question I think which was how to populate the tabs (aka document fields) in the template. You can identify a given tab by its tabLabel and populate it's value using the value property. For instance, if you had two tabs of type textTab (called Data fields in the UI) you can populate their values like this:
{
"email": "jane.doe#email.com",
"name": "Jane Doe",
"roleName": "RoleOne",
"recipientId": "1",
"clientUserId": "1001",
"tabs": {
"textTabs": [
{
"tabLabel": "ApplicantAddress",
"value": "221 Main St. Suite 1000 San Francisco, CA 94105"
},
{
"tabLabel": "ApplicantSSN",
"value": "12-345-6789"
}
]
}
}

Api version change but docs not updated?

I've been trying to do various things through your Mail REST API today and not having much success... My project (using the api) has been running for at least a month now, but requests to your api are failing.
For example:
GET https://outlook.office365.com/EWS/OData/Me/messages (works)
GET https://outlook.office365.com/EWS/OData/Me/inbox (doesn't work)
Looking at the documentation, still says its available.
Trying to send an email using:
POST https://outlook.office365.com/EWS/OData/Me/Messages?MessageDisposition=SendAndSaveCopy also just returns 400 (Bad Request)
Any info about this?
Also, the http status codes returned are not useful at all; almost all errors return as 400's. In one instance, I didn't provide auth creds, and a 400 was returned instead of the appropriate 401. The accompanying status code detail could also be more helpful.
Thanks for the feedback and sorry for the inconvenience. We are currently deploying some non-backwards compatible changes described here, and this is causing your issues. The current set of changes including versioning support, and deploying non-backwards compatible changes won't cause issues for your app in the future. For the queries, that don't work, please use the following:
Accessing Inbox: https://outlook.office365.com/ews/odata/me/folders/inbox
Send email (new action called SendMail):
POST https://outlook.office365.com/ews/odata/me/sendmail
{
"Message":
{
"Subject": "Test message",
"Body":
{
"Content": "This is test message!"
},
"ToRecipients":
[
{ "EmailAddress": { "Address": "John#contoso.com", "Name": "John Doe" }},
{ "EmailAddress": { "Address": "Jane#fabrikam.com", "Name": "Jane Smith" }}
]
},
"SaveToSentItems": true
}
Hope this helps. We are updating the documentation to reflect the changes, and it should be available shortly. Thanks for the feedback on the HTTP status codes, we will review the status codes returned currently and make any fixes required.
Conversation support is in our roadmap but we don't yet have a timeline to share. Currently, you can search using https://outlook.office365.com/ews/odata/Folders/FolderId/Messages?$filter=ConversationId%20eq%20%%27ConversationID%27 but this will only return messages within the specified folder belonging to that conversation.
Let me know if you have any questions or need more info.
Thanks,
Venkat

Resources