Box node API Can get folder info but cannot create folder - box-api

I'm sure I'm doing something wrong in the auth cycle but I keep getting 500s, and the messages are pretty vague.
So, I'm calling box from my node server. First I create a client:
const sdk = new BoxSDK({
clientID: process.env.CLIENT_ID,
clientSecret: process.env.CLIENT_SECRET,
appAuth: {
keyID: process.env.PUBLIC_KEY_ID,
privateKey: fs.readFileSync(path.resolve(__dirname, process.env.PRIVATE_KEY_PATH)),
passphrase: process.env.PRIVATE_KEY_PASSPHRASE,
},
});
app.use((req, res, next) => {
req.sdk = sdk.getAppAuthClient('user', process.env.BOX_USER_ID);
next();
});
Once I've created the client I trigger a request:
export function yearEnd(req, res) {
req.sdk.folders.create({
name: 'test',
parent: {
id: '0',
},
}, (e, r) => {
if (e) {
return res.send(e);
}
return res.status(201).send(r);
});
}
The response I get back is:
{
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "api.box.com",
"port": 443,
"hostname": "api.box.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/2.0/folders",
"path": "/2.0/folders",
"href": "https://api.box.com/2.0/folders"
},
"method": "POST",
"headers": {
"User-Agent": "Box Node.js SDK v1.0.0",
"Authorization": "[REMOVED BY SDK]",
"accept": "application/json",
"content-type": "application/json",
"content-length": 75
}
},
"response": {
"statusCode": 500,
"body": {
"type": "error",
"status": 500,
"code": "internal_server_error",
"help_url": "http://developers.box.com/docs/#errors",
"message": "Internal Server Error",
"request_id": "29462704457e0f3876ee08"
},
"headers": {
"server": "ATS",
"date": "Tue, 20 Sep 2016 08:29:59 GMT",
"content-type": "application/json",
"content-length": "188",
"cache-control": "no-cache, no-store",
"strict-transport-security": "max-age=31536000; includeSubDomains",
"vary": "Accept-Encoding",
"age": "0",
"connection": "keep-alive"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "api.box.com",
"port": 443,
"hostname": "api.box.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/2.0/folders",
"path": "/2.0/folders",
"href": "https://api.box.com/2.0/folders"
},
"method": "POST",
"headers": {
"User-Agent": "Box Node.js SDK v1.0.0",
"Authorization": "[REMOVED BY SDK]",
"accept": "application/json",
"content-type": "application/json",
"content-length": 75
}
}
},
"statusCode": 500,
"maxRetriesExceeded": true
}
Can anybody tell me what I'm doing wrong??

So, the docs and the method signature don't match. I had to go into the package and check the code by hand. To create, it's:
req.sdk.folders.create(<parent_id>, <folderName>, (e, r) => {...});

Related

jq: pick and remove nested fields

Here is my json:
[
{
"id": "7250078e-5fbf-43d7-9c67-94b88fbf44d8",
"priority": 0,
"httpRequest": {
"method": "POST",
"path": "/catalog-data-rest/oid/search.xml",
"headers": {
"Host": [
"preproduccio.gcatalegs.isisscat.intranet.gencat.cat:8443"
],
"Authorization": [
"Basic VVNVTVBJVFNUOkJ4c2w3MjU5"
],
"User-Agent": [
"curl/7.58.0"
],
"Accept": [
"*/*"
],
"Content-Type": [
"text/html; charset=utf-8"
],
"Content-Length": [
"94"
]
},
"keepAlive": true,
"secure": true,
"body": {
"type": "STRING",
"string": "<request><oid>2.16.724.4.402</oid><startIndex>1</startIndex><pageSize>100</pageSize></request>",
"rawBytes": "PHJlcXVlc3Q+PG9pZD4yLjE2LjcyNC40LjQwMjwvb2lkPjxzdGFydEluZGV4PjE8L3N0YXJ0SW5kZXg+PHBhZ2VTaXplPjEwMDwvcGFnZVNpemU+PC9yZXF1ZXN0Pg==",
"contentType": "text/html; charset=utf-8"
}
},
"httpResponse": {
"statusCode": 200,
"reasonPhrase": "OK",
"headers": {
"Date": [
"Tue, 20 Jul 2021 11:07:40 GMT"
],
"X-Powered-By": [
"Servlet/3.0"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-XSS-Protection": [
"1; mode=block"
],
"Cache-Control": [
"no-cache, no-store, max-age=0, must-revalidate"
],
"Pragma": [
"no-cache"
],
"Expires": [
"0"
],
"Strict-Transport-Security": [
"max-age=31536000 ; includeSubDomains"
],
"X-Frame-Options": [
"DENY"
],
"Set-Cookie": [
"JSESSIONID=0000r6GgpYaB7bQiXRaS8zB8qw8:19pp48tgo; Path=/; HttpOnly"
],
"Keep-Alive": [
"timeout=10, max=100"
],
"Connection": [
"Keep-Alive"
],
"Content-Type": [
"application/xml"
],
"Content-Language": [
"en-US"
],
"content-length": [
"29089"
]
},
"cookies": {
"JSESSIONID": "0000r6GgpYaB7bQiXRaS8zB8qw8:19pp48tgo"
},
"body": {
"type": "XML",
"xml": "string-value",
"rawBytes": "string-value",
"contentType": "application/xml"
}
},
"times": {
"remainingTimes": 1
},
"timeToLive": {
"unlimited": true
}
}
]
I need to remove and pick following fields:
From .httpRequest I need to REMOVE:
.httpRequest.headers
.httpRequest.keepAlive
.httpRequest.secure
.httpRequest.body.rawBytes
Desired result:
"httpRequest": {
"method": "POST",
"path": "/catalog-data-rest/oid/search.xml",
"body": {
"type": "STRING",
"string": "<request><oid>2.16.724.4.402</oid><startIndex>1</startIndex><pageSize>100</pageSize></request>",
"contentType": "text/html; charset=utf-8"
}
}
From .httpResponse I need to PICK:
.httpResponse.statusCode
.httpResponse.reasonPhrase
.httpResponse.headers.Content-Type
.httpResponse.headers.content-lenght
From .httpResponse I need to REMOVE:
.httpResponse.body.rawBytes
Desired result would be:
"httpResponse": {
"statusCode": 200,
"reasonPhrase": "OK",
"headers": {
"Content-Type": [
"application/xml"
],
"content-length": [
"29089"
]
},
"body": {
"type": "XML",
"xml": "string-value",
"contentType": "application/xml"
}
}
So my final json would be:
[
{
"httpRequest": {
"method": "POST",
"path": "/catalog-data-rest/oid/search.xml",
"body": {
"type": "STRING",
"string": "<request><oid>2.16.724.4.402</oid><startIndex>1</startIndex><pageSize>100</pageSize></request>",
"contentType": "text/html; charset=utf-8"
}
},
"httpResponse": {
"statusCode": 200,
"reasonPhrase": "OK",
"headers": {
"Content-Type": [
"application/xml"
],
"content-length": [
"29089"
]
},
"body": {
"type": "XML",
"xml": "string-value",
"contentType": "application/xml"
}
}
}
]
I hope I've explained so well.
Up to now I've able to get this demo
Create a fresh object (using {}) when you want to pick, and use del when you want to remove.
map({
"httpRequest": (
.httpRequest |
del(.headers, .keepAlive, .secure, .body.rawBytes)
),
"httpResponse": (
.httpResponse |
del(.body.rawBytes) |
{
statusCode,
reasonPhrase,
"headers": {
"Content-Type": .headers."Content-Type",
"Content-Length": .headers."content-length"
},
body
}
)
})
jqplay
The issue with both this solution and the previously-posted one is that HTTP headers are case-insensitive, so I don't think .headers."Content-Type" and .headers."content-length" will always work. Adjust as necessary.
Here is one way you could do it:
parse.jq
# We are only interested in the request and response objects
.[] | [ { httpRequest, httpResponse } ] |
# Delete unwanted paths
del(
.[].httpRequest.headers,
.[].httpRequest.keepAlive,
.[].httpRequest.secure,
.[].httpRequest.body.rawBytes,
.[].httpResponse.body.rawBytes
) |
# Reshape the httpResponse object
.[].httpResponse |=
(
{
statusCode,
reasonPhrase,
"headers" : {
"Content-Type" : .headers."Content-Type",
"content-length" : .headers."content-length"
},
body
}
)
Run it like this:
jq -f parse.jq infile.json
Output:
[
{
"httpRequest": {
"method": "POST",
"path": "/catalog-data-rest/oid/search.xml",
"body": {
"type": "STRING",
"string": "<request><oid>2.16.724.4.402</oid><startIndex>1</startIndex><pageSize>100</pageSize></request>",
"contentType": "text/html; charset=utf-8"
}
},
"httpResponse": {
"statusCode": 200,
"reasonPhrase": "OK",
"headers": {
"Content-Type": [
"application/xml"
],
"content-length": [
"29089"
]
},
"body": {
"type": "XML",
"xml": "string-value",
"contentType": "application/xml"
}
}
}
]

Creating Document Libraries through Flow with a single API call

My company currently have client SharePoint sites hosted on our O365 tenant, and previously whenever a new client was bought on board we'd create a SharePoint site for them using the GUI or Powershell, but in the interest of making things a little easier in the long run I'm now in the process of trying to automate site creation for any new clients that join us - Historically, all sites have been designed the same with more or less the same structure, the only difference being the files themselves. I've managed to automate the bulk of the SharePoint site creation through flow (Creating the site, Hub site linkage, ownership of site, group membership, external access, etc.) but I'm having trouble with creating the document libraries on newly created sites. There are 8 libraries overall, and whilst I have actually worked out how to create them each individually using the 'Send a HTTP request to SharePoint" action (I'm quite new to Flow and all this!), I'd like to try and use MS Graph and JSON batching instead, so I can create all 8 libraries in a single API call.
I've tested my JSON on the MS Graph Explorer, which works and and creates the libraries on a specified client site as expected, but when I try and do it through Flow, I get the below error and I'm not sure where I'm going wrong:
Error
The error message singles out the Headers, but I'm not sure what the issue is?
See below the HTTP action in the Flow:
HTTP Action
{
"inputs": {
"method": "POST",
"uri": "https://graph.microsoft.com/v1.0/$batch",
"headers": {
"content-type": "application/json;odata=verbose",
"authorization": "#{body('Parse_JSON')?['token_type']} #{body('Parse_JSON')?['access_token']}"
},
"body": {
"requests": [
{
"id": "1",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Management",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "2",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Employees",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "3",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Work Activities",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "4",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Work Equipment",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "5",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Substances",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "6",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Workplaces",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "7",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "HR",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
},
{
"id": "8",
"method": "POST",
"url": "/sites/devsite.sharepoint.com:/sites/BSS:/lists",
"body": {
"displayName": "Quality",
"list": {
"template": "documentLibrary"
}
},
"headers": {
"content-type": "application/json"
}
}
]
}
}
}
Would anyone be able to offer any insight?
Thank you!
"Weird, works for me"
Header parameters are correct (case insensitive) as well as request's body.
MS Flow sometimes behave totally unexplainably.
Please try again creating temporary flow with OAuth2 token HTTP request and Graph API HTTP request only.
For token JSON parsing purposes I used this schema:
{
"type": "object",
"properties": {
"token_type": {
"type": "string"
},
"expires_in": {
"type": "integer"
},
"ext_expires_in": {
"type": "integer"
},
"access_token": {
"type": "string"
}
}
}

Axios Post Response React Native & Mockable

I'm trying to post to my Mockable API using Axios and React Native,
I'm quite inexperienced with Axios and Mockable and am not sure If I'm getting the response that I'm suppose to.
To explain:
In my app I've got a set of data (order data) which I'm trying to post to my mockable api.
So what I expect is
to add an order with the data from below to my API everytime I hit post.
What is happening
Everytime I hit post an order does not get added to my API.
How do I add objects to my Mockable API using Axios and React Native?
class BarPaymentScreen extends Component{
static navigationOptions = {
// header: null,
};
constructor(props){
super(props);
this.state ={
isLoading: false,
orderRestaurantId : 'empty',
orderValue: 'empty',
orderProducts: 'empty',
orderTotalPrice: 'empty',
}
}
handleSubmit = () => {
this.setState({
orderRestaurantId : this.props.restaurantId,
orderValue: this.state.value,
orderProducts: this.props.products,
orderTotalPrice: this.props.totalPrice,
})
axios({
method: 'post',
url: 'https://demo3381137.mockable.io/orders',
data: {
orders: {
orderId: '1',
restaurantId: this.state.orderRestaurantId,
orderKey: "AppOrderKey",
userId: "1",
paymentStatus: "approved",
preparing: "approved",
orderStatus: "approved",
paymentMethod: this.state.orderValue,
totalPrice: this.state.orderTotalPrice,
order: [
{
product : "bier",
qty : "5"
}
]
}
}
}).then(function (response) {
console.log('response',response);
})
.catch(function (error) {
console.log("error response",error);
});
console.log('submit');
}
Response Data
response Object {
"config": Object {
"adapter": [Function xhrAdapter],
"data": "{\"orders\":{\"orderId\":\"1\",\"restaurantId\":\"empty\",\"orderKey\":\"AppOrderKey\",\"userId\":\"1\",\"paymentStatus\":\"approved\",\"preparing\":\"approved\",\"orderStatus\":\"approved\",\"paymentMethod\":\"empty\",\"totalPrice\":\"empty\",\"order\":[{\"product\":\"bier\",\"qty\":\"5\"}]}}",
"headers": Object {
"Accept": "application/json, text/plain, */*",
"Content-Type": "application/json;charset=utf-8",
},
"maxContentLength": -1,
"method": "post",
"timeout": 0,
"transformRequest": Object {
"0": [Function transformRequest],
},
"transformResponse": Object {
"0": [Function transformResponse],
},
"url": "https://demo3381137.mockable.io/orders",
"validateStatus": [Function validateStatus],
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
},
"data": Object {
"orders": Array [
Object {
"restaurantId": "1",
"order": Array [
Object {
"product": "bier",
"qty": "5",
},
Object {
"product": "wisky",
"qty": "5",
},
Object {
"product": "fanta",
"qty": "5",
},
],
"orderId": "1",
"orderKey": "F3SAR566T",
"orderStatus": "approved",
"paymentMethod": "approved",
"paymentStatus": "approved",
"preparing": "approved",
"totalPrice": 10,
"userId": "1",
},
],
},
"headers": Object {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0",
"content-length": "721",
"content-type": "application/json; charset=UTF-8",
"date": "Mon, 18 Mar 2019 20:45:23 GMT",
"server": "Google Frontend",
"x-cloud-trace-context": "9a52c3976772c84992f870c94d8316a2",
},
"request": XMLHttpRequest {
"DONE": 4,
"HEADERS_RECEIVED": 2,
"LOADING": 3,
"OPENED": 1,
"UNSENT": 0,
"_aborted": false,
"_cachedResponse": undefined,
"_hasError": false,
"_headers": Object {
"accept": "application/json, text/plain, */*",
"content-type": "application/json;charset=utf-8",
},
"_incrementalEvents": false,
"_lowerCaseResponseHeaders": Object {
"access-control-allow-origin": "*",
"cache-control": "public, max-age=0",
"content-length": "721",
"content-type": "application/json; charset=UTF-8",
"date": "Mon, 18 Mar 2019 20:45:23 GMT",
"server": "Google Frontend",
"x-cloud-trace-context": "9a52c3976772c84992f870c94d8316a2",
},
"_method": "POST",
"_requestId": null,
"_response": "{
\"orders\": [
{
\"orderId\": \"1\",
\"restaurantId\": \"1\",
\"orderKey\": \"F3SAR566T\",
\"userId\": \"1\",
\"paymentStatus\": \"approved\",
\"preparing\": \"approved\",
\"orderStatus\": \"approved\",
\"paymentMethod\": \"approved\",
\"totalPrice\": 10,
\"order\": [
{
\"product\" : \"bier\",
\"qty\" : \"5\"
},
{
\"product\" : \"wisky\",
\"qty\" : \"5\"
},
{
\"product\" : \"fanta\",
\"qty\" : \"5\"
}
]
}
]
}",
"_responseType": "",
"_sent": true,
"_subscriptions": Array [],
"_timedOut": false,
"_trackingName": "unknown",
"_url": "https://demo3381137.mockable.io/orders",
"readyState": 4,
"responseHeaders": Object {
"Cache-Control": "public, max-age=0",
"access-control-allow-origin": "*",
"content-length": "721",
"content-type": "application/json; charset=UTF-8",
"date": "Mon, 18 Mar 2019 20:45:23 GMT",
"server": "Google Frontend",
"x-cloud-trace-context": "9a52c3976772c84992f870c94d8316a2",
},
"responseURL": "https://demo3381137.mockable.io/orders",
"status": 200,
"timeout": 0,
"upload": XMLHttpRequestEventTarget {
Symbol(listeners): Object {},
},
"withCredentials": true,
Symbol(listeners): Object {
"error": Object {
"kind": 3,
"listener": [Function handleError],
"next": null,
},
"readystatechange": Object {
"kind": 3,
"listener": [Function handleLoad],
"next": null,
},
"timeout": Object {
"kind": 3,
"listener": [Function handleTimeout],
"next": null,
},
},
},
"status": 200,
"statusText": undefined,
}
Code worked, Mockable.io has a page which shows the response to my posts.

How to put records into a Kinesis stream from a NodeJS app (lambda)

I have a lambda function that needs to put records into a Kinesis stream. I am not getting an error (that I recognize), but the messages never seem to make it to the stream...
I know the stream itself works since I can push messages to it with the aws cli app.
I have verified the stream name and other parameters passed to the putRecord() function.
I am using this code to push the records to the stream:
const params = {
Data: payload,
PartitionKey: partitionKey,
StreamName: this.streamName,
};
const res = await this.awsKinesis.putRecord(params);
res is a big complicated object, but it contains error: null...
{
"domain": null,
"service": {
"config": {
"credentials": {
"expired": false,
"expireTime": null,
"accessKeyId": "ASIAT5YUDX4OWH5FGFYE",
"sessionToken": "FQoGZXIvYXdzEJr//////////wEaDFGkyxe1r9QSkkhSSyKKAgbrbB6ef77wtuCC4zIH3YB7C0xJPPoql1YtRGaxba5ZDSCwBBRSQ0cBeTPMmtdUqRGshdJjjLosON6QG0FGWdt3TNDrENxqFtxjrQAbCHXfIx3ARtnn6r2agZjXi9cGZhkdpvUMSIUpaC3ZC+E9wLLvkZyQBfTSsv6QdcoaKGqT8tJ9Px7Wp5BSV3Nw//NE0GtJwv0pXiQrb3c6p6GkETtAxBBVVgwJP1WYdF+kh+Gg24DxMPwwy66ayD6E7oZIWB4i7JaqMXHoDjf9D51bpWPUAVCKF9AVn3t4JiKFBVw7lFQC0m91N9HdcKLzGmjpvX4JJNzKwBA/D1TfALDsprrvU1u7r/RlyabzKIHtpeIF",
"envPrefix": "AWS"
},
"credentialProvider": {
"providers": [null, null, null, null]
},
"region": "eu-west-1",
"logger": null,
"apiVersions": {},
"apiVersion": null,
"endpoint": "kinesis.eu-west-1.amazonaws.com",
"httpOptions": {
"timeout": 120000
},
"maxRedirects": 10,
"paramValidation": true,
"sslEnabled": true,
"s3ForcePathStyle": false,
"s3BucketEndpoint": false,
"s3DisableBodySigning": true,
"computeChecksums": true,
"convertResponseTypes": true,
"correctClockSkew": false,
"customUserAgent": null,
"dynamoDbCrc32": true,
"systemClockOffset": 0,
"signatureVersion": "v4",
"signatureCache": true,
"retryDelayOptions": {},
"useAccelerateEndpoint": false
},
"isGlobalEndpoint": false,
"endpoint": {
"protocol": "https:",
"host": "kinesis.eu-west-1.amazonaws.com",
"port": 443,
"hostname": "kinesis.eu-west-1.amazonaws.com",
"pathname": "/",
"path": "/",
"href": "https://kinesis.eu-west-1.amazonaws.com/"
},
"_clientId": 1
},
"operation": "putRecord",
"params": {
"Data": "<< THE MESSAGE >>",
"PartitionKey": "c770e429-52e7-47c4-bcbc-497548ff9dee",
"StreamName": "my-stream"
},
"httpRequest": {
"method": "POST",
"path": "/",
"headers": {
"User-Agent": "aws-sdk-nodejs/2.290.0 linux/v6.10.3 exec-env/AWS_Lambda_nodejs6.10"
},
"body": "",
"endpoint": {
"protocol": "https:",
"host": "kinesis.eu-west-1.amazonaws.com",
"port": 443,
"hostname": "kinesis.eu-west-1.amazonaws.com",
"pathname": "/",
"path": "/",
"href": "https://kinesis.eu-west-1.amazonaws.com/"
},
"region": "eu-west-1",
"_userAgent": "aws-sdk-nodejs/2.290.0 linux/v6.10.3 exec-env/AWS_Lambda_nodejs6.10"
},
"startTime": "2019-01-24T08:25:42.574Z",
"response": {
"request": "~context",
"data": null,
"error": null,
"retryCount": 0,
"redirectCount": 0,
"httpResponse": {
"headers": {},
"streaming": false,
"stream": null
},
"maxRetries": 3,
"maxRedirects": 10
},
"_asm": {
"currentState": "validate",
"states": {
"validate": {
"accept": "build",
"fail": "error"
},
"build": {
"accept": "afterBuild",
"fail": "restart"
},
"afterBuild": {
"accept": "sign",
"fail": "restart"
},
"sign": {
"accept": "send",
"fail": "retry"
},
"retry": {
"accept": "afterRetry",
"fail": "afterRetry"
},
"afterRetry": {
"accept": "sign",
"fail": "error"
},
"send": {
"accept": "validateResponse",
"fail": "retry"
},
"validateResponse": {
"accept": "extractData",
"fail": "extractError"
},
"extractError": {
"accept": "extractData",
"fail": "retry"
},
"extractData": {
"accept": "success",
"fail": "retry"
},
"restart": {
"accept": "build",
"fail": "error"
},
"success": {
"accept": "complete",
"fail": "complete"
},
"error": {
"accept": "complete",
"fail": "complete"
},
"complete": {
"accept": null,
"fail": null
}
}
},
"_haltHandlersOnError": false,
"_events": {
"validate": [null, null, null, null],
"afterBuild": [null, null, null],
"restart": [null],
"sign": [null],
"validateResponse": [null],
"send": [null],
"httpHeaders": [null],
"httpData": [null],
"httpDone": [null],
"retry": [null, null, null, null, null, null],
"afterRetry": [null],
"build": [null],
"extractData": [null, null],
"extractError": [null, null],
"httpError": [null]
}
}
I would expect a message to appear in the Kinesis stream and to fire the lambda that is triggered by the stream, but this never happens.
Even in the web console, the Kinesis stream does not show any activity on the monitoring tab.
What could I be doing wrong?
Per the documentation the return value is a Request object.
putRecord(params = {}, callback) ⇒ AWS.Request
You need to call promise() on this Request object in order to get a promise that you can then await on.
const res = await this.awsKinesis.putRecord(params).promise();

My response is extending jersey response.How can i exclude other fields and send only my model class object as response?

In this response, it includes all fields from jersey response class. How can i remove these field from my response and send only entity as a response object.
I have generated my interfaces and model classes using RAML. So internally it my response object extends jersey response class.
{
"length": -1,
"language": null,
"location": null,
"allowedMethods": [],
"metadata": {
"Content-Type": [
"application/json"
]
},
"mediaType": {
"type": "application",
"subtype": "json",
"parameters": {},
"wildcardType": false,
"wildcardSubtype": false
},
"status": 200,
"date": null,
"headers": {
"Content-Type": [
"application/json"
]
},//Response obj
"entity": {
"user": "abcd",
"password": "xyz123",
"group": "mail"
},
"lastModified": null,
"cookies": {},
"links": [],
"statusInfo": "OK",
"entityTag": null,
"stringHeaders": {
"Content-Type": [
"application/json"
]
}
}