Cannot find mapping for Status field - acumatica

My application is integrated with Acumatica 2020R2. When I try to create a task (PUT /ProjectTask) with such body:
{
"Description": {
"value": "xxx"
},
"ProjectID": {
"value": "xxx"
},
"TaskID": {
"value": "xxx"
},
"Type2020R1": {
"value": "CostRev"
}
}
I get an error: Cannot find mapping for Status field: status.. The same when I add "Status" value to the payload. Any idea what this message means and when it can occur?

As I wrote in the comment above: client is using different Acumatica version (2021R1), our integration doesn't support it.

Related

how to pass parameters in azure pipeline using rest api?

I'm using postman to make rest requests to the azure API to run a pipeline that is in synapse, in terms of permissions and the token I already get them and it works, the problem is that the pipeline receives 3 parameters but I don't know how to pass them, so I have this request, example:
https://hvdhgsad.dev.azuresynapse.net/pipelines/pipeName/createRun?api-version=2020-12-01
and the parameters I added them in the body:
{
"parameters": {
"p_dir": {
"type": "string",
"defaultValue": "val1"
},
"container": {
"type": "string",
"defaultValue": "val"
},
"p_folder": {
"type": "string",
"defaultValue": "val3"
}
}
}
but when I validate the run that was launched with the request I get this.
{
"id": "xxxxxxxxxxxxxxx",
"runId": "xxxxxxxxxxxxxxxxxxxxx",
"debugRunId": null,
"runGroupId": "xxxxxxxxxxxxxxxxxxxx",
"pipelineName": "xxxxxxxxxxxxxxxxx",
"parameters": {
"p_dir": "",
"p_folder": "",
"container": ""
},
"invokedBy": {
"id": "xxxxxxxxxxxxxxxxx",
"name": "Manual",
"invokedByType": "Manual"
},
"runStart": "2021-07-20T05:56:04.2468861Z",
"runEnd": "2021-07-20T05:59:10.1734654Z",
"durationInMs": 185926,
"status": "Failed",
"message": "Operation on target Data flow1 failed: {\"StatusCode\":\"DF-Executor-SourceInvalidPayload\",\"Message\":\"Job failed due to reason: Data preview, debug, and pipeline data flow execution failed because container does not exist\",\"Details\":\"\"}",
"lastUpdated": "2021-07-20T05:59:10.1734654Z",
"annotations": [],
"runDimension": {},
"isLatest": true
}
the params are empty, so I don't know what's wrong or missing.
what is the correct way to pass them???
ref: https://learn.microsoft.com/en-us/rest/api/synapse/data-plane/pipeline/create-pipeline-run#examples
Just created an account to answer this as i've had the same issue.
I resolved this by just having the name of the variable and its subsequent value in the body JSON.
e.g.
{"variable": "value", "variable": "value"}
Found this by following the documentation you had posted, under request body it passes the name of the variable and the value directly into the JSON body.
{
"OutputBlobNameList": [
"exampleoutput.csv"
]
}
This particular example is a list/array so it confused me by adding the brackets [] if you are passing string parameters this is unneeded.

How to use openapi3 json specification to validate if Express application has set up correct routes?

Summary
I use orval to generate frontend code in order to fetch data from the backend. The API specification is using the openapi 3 format.
I want to be able to automatically validate if my express backend is implementing the correct endpoints by comparing the specification with the actual implementation.
Example
Let's assume that this is the specification api.json:
{
"openapi": "3.0.0",
"info": {
"version": "1.0.0",
"title": "My Service"
},
"servers": [
{
"url": "http://my.service.com/api"
}
],
"paths": {
"/my-endpoint": {
"get": {
"summary": "List all things",
"operationId": "listThings",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Thing"
}
}
}
},
"default": {
"description": "unexpected error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Thing": {
"type": "object",
"required": [
"id",
"name"
],
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"Error": {
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
Orval generates frontend code to fetch defined endpoints via axios and the according Typescript interfaces for request and response data.
So far so good.
Problem
My express backend does not know about the openapi specification. I need to manually create the correct express endpoints and make sure that they return the correct HTTP codes, correct response types and correct error handling.
I learned there are code generators like swagger-routes-express, but my concern with those is that they hide the endpoint definition and that it could be difficult to implement extra business logic to those endpoints. I may be wrong here, but i still didn't get how that would work in this scenario.
Desired solution
I think there are two variants that would be a great outcome:
A code generator that parses the api.json above and generates correct endpoints with proper Typescript types. It needs to be able to accept custom code in those endpoints which shouldn't be overwritten the next time the specification changes and code is regenerated.
A linter that checks the code if the correct endpoints exist and have the correct request and response types. Maybe a set of eslint rules.
Is there anything out there i could use for this?

Azure REST API for running builds or pipelines

I am trying to automate the creation of Azure Pipelines for a particular branch using their REST api.
However, I am struggling to use almost all their API's, as their documentation lacks examples.
Things like List and Get are simple enough.
However, when it comes to queuing a build:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.0
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=6.0
{
"parameters": <parameters>, // how do i send paramters
"definition": {
"id": 1
},
"sourceBranch": "refs/heads/feature/my-pipeline",
"sourceVersion": "d265f01aeb4e677a25725f44f20ceb3ff1d7d767"
}
I am currently struggling to send parameters.
I have tried:
Simple JSON like:
"parameters": {
"appId": "bab",
"platform": "android",
"isDemo": true
}
and stringify version of JSON like:
"parameters": "{\"appId\": \"bab\",\"platform\": \"android\",\"isDemo\": true}"
but none seems to work.
It keeps giving me the error:
{
"$id": "1",
"customProperties": {
"ValidationResults": [
{
"result": "error",
"message": "A value for the 'appId' parameter must be provided."
},
{
"result": "error",
"message": "A value for the 'platform' parameter must be provided."
},
{
"result": "error",
"message": "A value for the 'isDemo' parameter must be provided."
}
]
},
"innerException": null,
"message": "Could not queue the build because there were validation errors or warnings.",
"typeName": "Microsoft.TeamFoundation.Build.WebApi.BuildRequestValidationFailedException, Microsoft.TeamFoundation.Build2.WebApi",
"typeKey": "BuildRequestValidationFailedException",
"errorCode": 0,
"eventId": 3000
}
The docs is very unclear in how to send this data: https://learn.microsoft.com/en-us/rest/api/azure/devops/build/builds/queue?view=azure-devops-rest-6.1#propertiescollection
Thank you very much for you help.
I believe you cannot pass runtime parameters trough the Queue API. Instead, use Runs API
With that, your request body (use Content-type: application/json) should look something similar to this:
{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/feature/my-pipeline"
}
}
},
"templateParameters": {
"appId": "bab"
"platform": "android"
"isDemo": true
}
}
I just realized that in the api-version=6.0 you can also send templateParameters on the Queue Service:
POST https://dev.azure.com/{organization}/{project}/_apis/build/builds?sourceBuildId={BUILD_BUILDID}&api-version=6.0
{
"templateParameters": { "doReleaseBuild": "True" },
"definition": {
"id": 1
},
"sourceBranch": "refs/heads/feature/my-pipeline",
"sourceVersion": "d265f01aeb4e677a25725f44f20ceb3ff1d7d767"
}

Employee Time Activity Entry through Endpoint

Hi im trying to do a PUT request for a Employee Time Activity but im not having much luck. I keep getting errors like project task cannot be found in the system. But the project task does exist and when I enter the same details directly in the form it works fine.
Does anybody have a example JSON body of creating a new employee activity record that can help me?
Below is my current body
{
"Employee": {
"value": "MATTMCD"
},
"Items": [
{
"ActivityDate": {
"value": "2020-03-02T00:00:00"
},
"ActivityTime": {
"value": "2020-03-01T22:00:00"
},
"CostCode": {
"value": "0000"
},
"Billable": {
"value": true
},
"LabourItem": {
"value": "LABOUR-MAT"
},
"Project": {
"value": "PR00000001"
},
"ProjectTask": {
"value": "TESTTASK"
},
"Description": {
"value": "Labour Matt"
},
"TimeSpent": {
"value": "01:30"
}
}
]
}
I ended up just using the activity screen to enter time activities. This gave me some flexibility with the dates as well which I needed instead of having to enter a time entry for the current week.

Cloning Resource Group on Azure error: The account XYZ is already in another resource group in this susbscription

I need to clone a Resource Group on Azure. To test the process I created a new one, and added one VM to it.
Then I went to Resource Groups > [my group] > Automation Script > Deploy, accepted the terms and conditions and clicked Purchase.
The result is this error:
{"telemetryId":"05cbc6fb-2597...", "bladeInstanceId":"Blade_f46316807e514f23acb93...","galleryItemId":"Microsoft.Template","createBlade":"DeployToAzure","code":"InvalidTemplateDeployment","message":"The template deployment 'Microsoft.Template' is not valid according to the validation procedure. The tracking id is '4f29d0ac-30b8...'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.","details":[{"code":"PreflightValidationCheckFailed","message":"Preflight validation failed. Please refer to the details for the specific errors.","details":[{"code":"StorageAccountInAnotherResourceGroup","target":"appsvcr...","message":"The account appsvc... is already in another resource group in this susbscription."}]}]}
The error description is
The account appsvc... is already in another resource group in this susbscription
I tried editing the template, or the parameters, to remove the Storage Account, or move the storage account itself, but then I get an error that the account cannot be empty.
Any idea how to solve this?
EDIT: the parameters tab from the Deploy section:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachines_TestRGVM1_name": {
"value": null
},
"networkInterfaces_testrgvm114_name": {
"value": null
},
"networkInterfaces_testrgvm1440_name": {
"value": null
},
"publicIPAddresses_TestRGVM1_ip_name": {
"value": null
},
"publicIPAddresses_TestRGVM1ip746_name": {
"value": null
},
"networkSecurityGroups_TestRGVM1_nsg_name": {
"value": null
},
"networkSecurityGroups_TestRGVM1nsg740_name": {
"value": null
},
"storageAccounts_appsvcrglinuxcentralu225_name": {
"value": null
},
"virtualNetworks_appsvc_rg_Linux_CentralUS_vnet_name": {
"value": null
},
"virtualNetworks_TestCloningBase_virtual_network_name": {
"value": null
},
"securityRules_SSH_name": {
"value": null
},
"securityRules_RDP_name": {
"value": null
},
"securityRules_SSH_name_1": {
"value": null
},
"securityRules_RDP_name_1": {
"value": null
},
"disks_TestRGVM1_OsDisk_1_fa82f490edc742d4b4fc47cf9d8f1a77_name": {
"value": null
},
"subnets_default_name": {
"value": null
},
"subnets_default_name_1": {
"value": null
},
"securityRules_Ports_22000_22005_name": {
"value": null
},
"virtualMachines_TestRGVM1_id": {
"value": null
}
}
}
You need to change storage account name to something else as storage account names have to be unique across all Azure. depending on how your template is structured you would need to modify parameters\variables\hardcoded values

Resources