im trying to use seneca for microservice stuffs. im new and inexperience in this field. i have a problem where my json object received is undefined but it shows in the console.log.
console.log("company:", body.data.company)
company = body.data.company
and this is the error result. it shows that it the company clearly contains a value and not a null
company: BST
{"notice":"seneca: Action cmd:addMember,role:client failed: company is not defined.","code":"act_execute","err":{"eraro":true,"orig":{},
"code":"act_execute","seneca":true,"package":"seneca","msg":"seneca: Action cmd:addMember,role:client failed: company is not defined. ...
From the above provided information i can tell that company field not defined means it is not present into body.data
try printing body on console and check the whole incoming data.
Related
I'm doing a API request using Web.Contents. I submit a dynamic access token, which I get from a function.
let
Source =
Json.Document(
Web.Contents(
{"https://api-url.com/endpoint/id"},
[Headers=[Authorization="Bearer "& GetToken()]]))
in Source
This works in all of my other instances, but for some reason I get an error with a specific endpoint, to which I submit a id. The error is:
Expression.Error: We cannot convert a value of type List to type Text.
Details:
Value=[List]
Type=[Type]
I have checked the documentation for the API, and the response is composed of the following
id - Id of the device
lastServicedDate - The last time the service was done.
trip -
total -
stateLastUpdated - the timestamp of the state.
Previous assistance have informed me that I need to expand the list, but I cannot seem to make this work.
Any assistance is highly appreciated. Thank you.
You are supplying a list to Web.Contents instead of text. {} denotes a list. Remove your braces:
Web.Contents(
"https://api-url.com/endpoint/id",
[Headers=[Authorization="Bearer "& GetToken()]])
When I am calling API its giving data in [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] format which is only value. Is there any solution that how to get this data in UI in flutter?
Previously I have worked with below type of data coming from API.In this data can be accessed using key name but how to access value in [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] format when there is no key to access value in Flutter?
[{"activityId":101,"docId":90,"status":1},{"activityId":101,"docId":100,"status":0},{"activityId":101,"docId":159,"status":0},{"activityId":101,"docId":201,"status":0},{"activityId":1784,"docId":123,"status":1}]
This looks like basic List<List<int>> so if data is [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]] let's say you want to access number 4 from the start of the message you'd need to access it like:
final response = <List<int>> [[101,4],[102,2],[103,1],[104,1],[105,1],[108,1],[109,1]]
int four = response[0][1];
print('$four')
in terminal would print value 4
I am doing an HTTP GET request to /maximo/oslc/os/mxsr and using the oslc.select query string parameter to choose:
*,doclinks{*},worklog{*},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
This lets me get related data, including related worklogs, but the worklog does not include the 'description_longdescription' field.
The only way I seem to be able to get that field is if I do a separate HTTP GET to query a worklog id directly through /maxrest/rest/mbo/worklog . Then it provides the description_longdescription field.
I understand this field is stored separately through the linked longdescription table, but I was hoping to get the data through the "next gen" oslc api with one http get request.
I've tried putting in 'worklog{*,description_longdescription}', as I read somewhere that longdescription is a "non-persistent" field and must be explicitly named for inclusion, but it had no effect.
I figured out that for the /maximo/oslc/os/mxsr object in the API, I needed to reference the related MODIFYWORKLOG object through the rel.modifyworklog syntax in the oslc.select query string:
oslc.select=*,doclinks{*},rel.modifyworklog{*,description_longdescription},rel.commlog{*},rel.woactivity{*,rel.woactivity{*}}
I also had to explicitly name the non-persistent field description_longdescription for it to be included.
Ref. for the "rel." syntax: https://developer.ibm.com/static/site-id/155/maximodev/restguide/Maximo_Nextgen_REST_API.html#_querying_maximo_asset_management_by_using_the_rest_api
I'm trying to creating a global service in angular app with BehaviorSubject.
I have created a method in this service where I have defined a HTTP get method and loading JSON file.
Now the issue I'm facing is when I'm subscribing this BehaviourSubject as asObservable in any component and assign the result to a particular variable in the typescript file, the HTML template renders this value correctly via structured Directive *ngFor but when I'm trying to get the same value in typescript file, it does not work.
For example;
When I'm trying to print this value
console.log(this.data.boxes.length);
then it gives me an error
[ERROR TypeError: Cannot read property 'length' of undefined]
and when I'm trying to print this value without length
console.log(this.data.boxes);
it gives me a proper value of an array in the console panel.
Now If I change BehaviorSubject to Subject, then its working fine means I am also getting length value.
However, I want to use BehaviorSubject instead of Subject.
What am I doing wrong and how can I achieve it?
Behavior subject is emitting current value to subscriber even if subject next is not called before subscription, in other words:
yours subscription is subscribed to subject before first "next" value. I assume that initial value of behavior subject is undefined or similar, so that first value that is emitted to subscriber is causing error.
Could you check declaration of subject and ensure that initial value is in correct form, like:
public exampleSubject = new BeahviourSubject<yourType[]>(<yourType[]>[]);
When I store a specific domain object (grom) in my grails-2.1.1 Application, I get the following exception:
java.sql.SQLException: No value specified for parameter 1
I use mysql as my database. I just want to persist my domain object. I tried to replace the logic inside my controller by
def hauptprojektInstance = Hauptprojekt.get(params.id)
hauptprojektInstance.save(flush: true)
but even this query fails with the same error.
The Hauptprojekt-domain model has a OneToMany and a OneToOne relation to other objects.