using commission junction API in CJ platform anyone using successfully? - node.js

Is anyone successfully using the CJ web services? while passing the parameters as text or xml am getting error.This is my code
Here is my code am using
This is the Params am using
and am getting the error like this...below I've mentioned
{
"statusCode": 400,
"body": "{"data":null,"errors":[{"message":"Syntax error while parsing GraphQL query. Invalid input """2", expected Value or Argument (line 1, column 71):\n{ publisherCommissions(forPublishers: [""5638564""], sincePostingDate:""2022-12-01T00:00:00Z"",beforePostingDate:""2022-12-28T00:00:00Z""){count payloadComplete records {actionTrackerName websiteName advertiserName postingDate pubCommissionAmountUsd items { quantity perItemSaleAmountPubCurrency totalCommissionPubCurrency }} }}\n ^"}]}",
}
please can someone solve this problem?
data is showing null I want to show the transaction details.

Related

'Invalid filter clause' while using 'ReceivedDateTime' in GRAPH API

I am writing a script to read a mailbox every 1hr and download its attachments. I am following [this][1] python tutorial
Below is my code to get emails for the day
def get_all_msg(self):
endpoint = "/me/mailFolders/inbox/messages?$filter=ReceivedDateTime ge '2022-10-05T08:40:20Z'"
request_url = f'{endpoint}'
inbox_response = self.user_client.get(request_url)
return inbox_response.json()
This gives the following error
{'error': {'code': 'BadRequest', 'message': 'Invalid filter clause', 'innerError': {'date': '2022-10-06T09:40:20', 'request-id': '4b76e1be-6f5b-45b6-90e7-c374673b3543', 'client-request-id': '11281235-f9a1-4dbc-a9e4-bedd85d46145'}}}
Not sure whats wrong.
Any help is appriciated
[1]: https://learn.microsoft.com/en-us/graph/tutorials/python?tabs=aad
Agreed with Gaurav comment ,when you use the time in '' it will consider as string , so you need to use without single quote , could you please try with API - https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messages?$filter=receivedDateTime ge 2022-10-05T08:40:20Z
Please see the docs for more info - https://learn.microsoft.com/en-us/graph/filter-query-parameter
Hope this helps
Thanks

Complex Queries for Side-by-Side SuccessFactors extension using SAP Cloud SDK (NodeJS)

I am trying to create request builders using SAP Cloud SDK for calling Successfactors Odata APIs. I am facing issues with complex OData querying that includes $expand and maybe custom fields.
https://xxxx.xxxx.xx/odata/v2/WfRequest(11111L)?$expand=wfRequestUINav
I created the request builder as below for the above api:
WfRequest.requestBuilder()
.getByKey(11111)
.select(
WfRequest.WF_REQUEST_UI_NAV
)
.execute({
destinationName: "sfapi"
});
I am getting the below error:
OData get by key request failed!
So I modified the code by adding TO_ to WF_REQUEST_UI_NAV as below:
WfRequest.TO_WF_REQUEST_UI_NAV
but still getting the same error. So I thought it may be a custom field and changed the code as below:
const WF_REQUEST_UI_NAV = WfRequest.customField('wfRequestUINav');
function getWFRequestsDetail() {
return WfRequest
.requestBuilder()
.getByKey(11111)
.select(
WF_REQUEST_UI_NAV
)
.execute({
destinationName: "sfapi"
});
I got the below output, but not the expanded result:
{
"wfRequestUINav": {
"__deferred": {
"uri": "https://api12preview.sapsf.eu/odata/v2/WfRequest(11111L)/wfRequestUINav"
}
}
}
Can anyone help in fixing this issue?
Thanks & Regards,
Harish
I guess the answer can be found in the answers.sap.com as mentioned.

Time series insight API returning Could not cast or convert from System.String to Microsoft.Rdx.Client.Events.Property

Hi we have just started using time series insight .We need to list specified list of values of properties under particular Time series id .As per the documentation in azure we were using the following API in post method to achieve this .
https://XXXXX_EnvironmentFqdn_XXXXX.env.timeseries.azure.com/timeseries/query?api-version=2018-11-01-preview
When posting the following request body to the API
{
"getEvents":{
"timeSeriesId": ["UniqueId"],
"searchSpan": {
"from": "2019-02-17T00:00:00Z",
"to": "2019-02-18T00:16:50Z"
},
"projectedProperties": ["DesiredProp"]
}
}
it returns a 400 Bad Request with following error message.
{
"error": {
"code": "InvalidInput",
"message": "Error converting value \"DesiredProp\" to type
'Microsoft.Rdx.Client.Events.Property'. Path
'getEvents.projectedProperties[0]', line 9, position 45.\r\n---> Could
not cast or convert from System.String to
Microsoft.Rdx.Client.Events.Property.\r\n"
}
}
on removing the projectedProperties property from response body API works fine,but it will return all the properties of the time series .
any help will me much appreciated and thanks in advance .

How to extract the message value from JSON in Node.js

My JSON is:
body =
{
"session_id":"45470003-6b84-4a2b-bf35-e850d1e2df8b",
"message":"Thanks for calling service desk, may I know the store number you are calling from?",
"callstatus":"InProgress",
"intent":"",
"responseStatusCode":null,
"responseStatusMsg":null,
"context":"getstorenumber"
}
How to get message value using Node js? Please let me know after testing.
i tried body.message and body['message'] and also body[0]['message']. I am always getting "undefined"
#Chris comment, since the problem is sorted out, Adding the answer to all members for future ref.
From node.js result, body is taken as JSON string, using JSON.parse.body converted to json object.
body =
{
"session_id":"45470003-6b84-4a2b-bf35-e850d1e2df8b",
"message":"Thanks for calling service desk, may I know the store number you are calling from?",
"callstatus":"InProgress",
"intent":"",
"responseStatusCode":null,
"responseStatusMsg":null,
"context":"getstorenumber"
}
JSON.parse.body
console.log(body.message);

Odata $filter for the date in the Office 365 REST API

I'm trying to retrieve events for a user from its Office 365 account using the REST API but filtered by the field "Start". For instance, retrieve all the events that will happen after the date: 2014-08-29T09:13:28' but i'm always retrieving this error message
{
"error": {
"code": "ErrorInvalidUrlQuery",
"message": "The query parameter '$filter' is invalid.",
"innererror": {
"message": "The query parameter '$filter' is invalid.",
"type": "Microsoft.Exchange.Services.OData.InvalidUrlQueryException",
"stacktrace": " at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()
at Microsoft.Exchange.Services.OData.ODataContext..ctor(HttpContext httpContext, Uri requestUri, ServiceModel serviceModel, ODataPathWrapper odataPath, ODataUriParser odataUriParser)
at Microsoft.Exchange.Services.OData.Web.RequestBroker.InitializeODataContext()
at Microsoft.Exchange.Services.OData.Web.RequestBroker.Process()",
"internalexception": {
"message": "A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.Int32' for operator kind 'Equal'.",
"type": "Microsoft.OData.Core.ODataException",
"stacktrace": " at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, SingleValueNode& left, SingleValueNode& right)
at Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)
at Microsoft.OData.Core.UriParser.Parsers.MetadataBinder.Bind(QueryToken token)
at Microsoft.OData.Core.UriParser.Parsers.FilterBinder.BindFilter(QueryToken filter)
at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilterImplementation(String filter, IEdmType elementType, IEdmNavigationSource navigationSource)
at Microsoft.OData.Core.UriParser.ODataUriParser.ParseFilter()
at Microsoft.Exchange.Services.OData.Web.ODataQueryOptions.Populate()"
}
}
}
}
Here all the thing i've tried:
[ressource]=https://outlook.office365.com/
url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'2012-05-29T09:13:28'
url: [ressource]EWS/OData/Me/Events?$filter=Start%20eq%20DateTime'20141231'
url: [ressource]EWS/OData/Me/Events?$filter=month(Start)%20eq%2012
And i've tried the $filter on string field or the $select on the field Start and it worked perfectly so i think my error is caused by the date format but i don't know how to solve it, so if anybody could help me on that, it woud be great!
Thank you!
Filtering on dates does work, but you can't do everything in the OData v4 spec. For example, these all work for me:
/Me/Events?$filter=Start eq 2014-08-28T21:00:00Z
/Me/Events?$filter=Start ge 2014-08-28T21:00:00Z
Adding the "DateTime" in front of it makes it fail. The same with the month function. If you stick with the format above it should work for you.
In V2 of the O365 REST API you should use:
URL encoded: $filter=Start/DateTime%20ge%20%272017-03-15T00:00:00Z%27
Not URL encoded: $filter=Start/DateTime ge '2017-03-15T00:00:00Z'
More info https://msdn.microsoft.com/en-us/office/office365/api/complex-types-for-mail-contacts-calendar#filter-requests
Hi Just increase top=100 or more whatever you want to pull from your inbox.
https://outlook.office365.com/api/v2.0/me/MailFolders/Inbox/messages/?%24select=CreatedDateTime%2cLastModifiedDateTime%2cChangeKey%2cCategories%2cReceivedDateTime%2cSentDateTime%2cHasAttachments%2cSubject%2cBody%2cImportance%2cParentFolderId%2cSender%2cFrom%2cToRecipients%2cCcRecipients%2cBccRecipients%2cReplyTo%2cConversationId%2cIsDeliveryReceiptRequested%2cIsReadReceiptRequested%2cIsRead%2cIsDraft%2cWebLink&%24top=100&%24skip=0"

Resources