According to document I am testing API using Insomnia. Generating a payment document is a single operation that I have used a single POST call to the intended document endpoint
create, for example:
POST https://app.sandbox-new.flowpay.it/api/:tenantID/invoices
Content-Type: application/json
Authorization: Bearer <accessToken>
Body:
{
"attachments": null,
"currency": "EUR",
"date": "2022-08-23T17:32:28Z",
"items": [
{
"amount": 123.12,
"description": "hello",
"quantity": 1
}
],
"number": "123465",
"recipientIban": null,
"recipientVat": "132412341",
"senderIban": null,
"senderVat": "23412341245",
"terms": [
{
"amount": 123.12,
"description": "hello",
"expire": "2022-08-25T17:32:28Z",
"information": "hello",
"method": null,
"recurringInfo": null
}
]
}
To get :tenantID I have followed flowpay documentation
But I am getting not authorized to upload this invoice error message.
{
"errorDescription": "not authorized to upload this invoice",
"code": 2003,
"statusCode": 401,
"requestID": "1FAF3537-FA0B-4642-AF75-94FE9FDC8E2A",
"service": 2
}
Any body help me please. Thanks
Related
I am developing an application that communicates with PayPal's API to create invoices.
This is my Request Body:
{
"detail": {
"currency_code": "USD",
"note": "Thank you for using my services!"
},
"invoicer": {
"name": {
"given_name": "Shreyas",
"surname": "Ayyengar"
},
"email_address": "{email}",
"website": "{website}"
},
"primary_recipients": [
{
"billing_info": {
"email_address": "{client_email}"
}
}
],
"items": [
{
"name": "{invoice_name}",
"description": "{invoice_description}",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "{invoice_amount}"
},
"tax": {
"name": "PayPal Service Tax",
"percent": "7.25"
}
}
],
"configuration": {
"partial_payment": {
"allow_partial_payment": false
},
"allow_tip": true
}
}
While there are placeholders like: {client_email}, I can guarantee that they are replacing properly and as expected.
However I'm thrown a VALIDATION_ERROR which I am not able to understand: {"name":"VALIDATION_ERROR","message":"Invalid request - see details.","information_link":"https://developer.paypal.com/docs/api/invoicing/#errors","details":[{"field":"merchant_info","issue":"cannot be null."},{"field":"items[0].unit_price","issue":"null"}]}
From what I can minimally understand, this error says that I have missing information like Items[].unit_price and merchant_info however I have no idea where this is supposed to be in my Request Body. I am following the direct documentationhere but I cannot see anything that mentions unit_price or merchant_info.
Submit your request to the correct API endpoint, https://api-m.sandbox.paypal.com/v2/invoicing/invoices
Note the major version number. See the Invoicing API reference for details.
I have 2 topics to receive data from API, those I can Successfully executed through code. Now I'm trying to execute through rest api using postman tool. now i'm getting InvalidRequestException. Before attempting request I fetched the external tasks using camunda get external-task api and my topics showing there.Later I tried to use /external-task/fetchAndLock API to send input variables.
External tasks response is:
http://localhost:8080/engine-rest/external-task
[
{
"activityId": "Activity_0jokenq",
"activityInstanceId": "Activity_0jokenq:0623e6f2-4837-11ec-8c7e-02426d005d3a",
"errorMessage": null,
"executionId": "0623e6f1-4837-11ec-8c7e-02426d005d3a",
"id": "0623e6f3-4837-11ec-8c7e-02426d005d3a",
"lockExpirationTime": null,
"processDefinitionId": "Process_0qcjqnm:1:da2ae20a-4836-11ec-8c7e-02426d005d3a",
"processDefinitionKey": "Process_0qcjqnm",
"processDefinitionVersionTag": null,
"processInstanceId": "0623bfdb-4837-11ec-8c7e-02426d005d3a",
"retries": null,
"suspended": false,
"workerId": null,
"topicName": "yvalue",
"tenantId": null,
"priority": 0,
"businessKey": null
},
{
"activityId": "Activity_1xxpyet",
"activityInstanceId": "Activity_1xxpyet:0623e6f6-4837-11ec-8c7e-02426d005d3a",
"errorMessage": null,
"executionId": "0623e6f5-4837-11ec-8c7e-02426d005d3a",
"id": "0623e6f7-4837-11ec-8c7e-02426d005d3a",
"lockExpirationTime": null,
"processDefinitionId": "Process_0qcjqnm:1:da2ae20a-4836-11ec-8c7e-02426d005d3a",
"processDefinitionKey": "Process_0qcjqnm",
"processDefinitionVersionTag": null,
"processInstanceId": "0623bfdb-4837-11ec-8c7e-02426d005d3a",
"retries": null,
"suspended": false,
"workerId": null,
"topicName": "testingtopic",
"tenantId": null,
"priority": 0,
"businessKey": null
}
]
my request is:
POST http://localhost:8080/engine-rest/external-task/fetchAndLock
{
"workerId": 1,
"maxTasks": 100,
"topics": [
{
"topicName": "testingtopic",
"lockDuration": 100000,
"variables": {
"a": {
"value": 1,
"type": "long"
},
"b": {
"value": 2,
"type": "long"
},
"id": {
"value": 1,
"type": "long"
}
}
}
],
"asyncResponseTimeout": 5
}
my BPMN diagram is:
Sorry mistake was mine I mentioned wrongly in request body. I mentioned
"variables": {}
But it's a array of json "variables": []
I mentioned here just variable names "variables": ["a","b","id"]
Later I used POST /external-task/{id}/complete request to pass with values to complete the process
I need to know if there is a way to delete a user from databricks using email only using SCIM api? As of now I can see it can only delete user by ID which means I need to first retrive the ID of the user and then use it to delete.
I am using this api from powershell to delete users by email.
https://learn.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/scim/scim-users
If you look into the documentation for Get Users command of SCIM Users REST API, you can see that you can specify the filtering condition for it. For example, to find specific user, you can filter on the userName attribute, like this:
GET /api/2.0/preview/scim/v2/Users?filter=userName+eq+example#databricks.com HTTP/1.1
Host: <databricks-instance>
Accept: application/scim+json
Authorization: Bearer dapi48…a6138b
it will return a list of items in the Resources section, from which you can extract user ID that you can use for delete operation:
{
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 1,
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:ListResponse"
],
"Resources": [
{
"id": "8679504224234906",
"userName": "example#databricks.com",
"emails": [
{
"type": "work",
"value": "example#databricks.com",
"primary": true
}
],
"entitlements": [
{
"value": "allow-cluster-create"
},
{
"value": "databricks-sql-access"
},
{
"value": "workspace-access"
}
],
"displayName": "User 1",
"name": {
"familyName": "User",
"givenName": "1"
},
"externalId": "12413",
"active": true,
"groups": [
{
"display": "123",
"type": "direct",
"value": "13223",
"$ref": "Groups/13223"
}
]
}
]
}
This is the sample response json which that Facebook sends to the server once some user mentions page in his post (This json is mentioned as the sample json by facebook):
{
"field": "mention",
"value": {
"post_id": "44444444_444444444",
"sender_name": "Example Name",
"item": "post",
"sender_id": "44444444",
"verb": "add"
}
}
However the json which I am receiving does not contain sender name and sender id :
{
"entry": [
{
"id": {page_id},
"time":{timestamp},
"changes": [
{
"field": "mention",
"value": {
"item": "post",
"verb": "add",
"message": "{message}",
"post_id": "44444444_444444444",
"created_time": {timestamp}
}
}
]
}
],
"object": "page"
}
Can anyone tell me , why Facebook is not sending sender name and sender id .
I am using FB API version :3.2
Permissions are manage_pages, publish_pages
I am testing boilerplate library for dotnet core with json:api specification from github repo {json:api}. The endpoints for GET (with or without query), POST & DELETE are working as expected when I send from postman. But I couldn't find working examples to change the existing resource with PUT or PATCH. When i send patch request with data, it give me back response "200 OK" but it didn't change in database. Below are my request and response.
Request GET : http://localhost:5000/api/people -> 200 OK
Response : [
{
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
},
{
"name": "John",
"articles": null,
"id": 3,
"stringId": "3"
},
{
"name": "Robbin",
"articles": null,
"id": 4,
"stringId": "4"
} ]
Request GET: http://localhost:5000/api/people/2 -> 200 OK
Response : {
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
}
Request GET: http://localhost:5000/api/people/2?include=articles -> 200 OK
Response : {
"name": "Samuel",
"articles": [],
"id": 2,
"stringId": "2"
}
Request POST: http://localhost:5000/api/people -> 201 Created
Request Body: {"name":"Samuel"}
Response : {
"name": "Samuel",
"articles": null,
"id": 2,
"stringId": "2"
}
Request DELETE: http://localhost:5000/api/people/2 -> 204 No Content
How can I update data?
I made a final decision after reading specification documents of JSONAPI and OData. I will just stick to my own format for better understanding of my own code and I recommend Swagger for Api Documentation. It doesn't make sense if the spec doesn't meet my requirement even when people are telling it's the standard.
I found in documents that require to includes following two headers for different api calls and body request is also different for PATCH.
"Accept: application/vnd.api+json" <--- This needs to put in header
"Content-Type: application/vnd.api+json" <--- This also needed.
Request PATCH: http://localhost:5000/api/people/3 -> 200 OK
// Request body becomes text, anybody knows how to format to JSON?
Request Body(Text): {
"data": {
"type": "people",
"attributes": {
"name": "John"
}
}
}
Response : {
"data": {
"attributes": {
"name": "John"
},
"relationships": {
"articles": {
"links": {
"self":
"http://localhost:5000/api/people/3/relationships/articles",
"related": "http://localhost:5000/api/people/3/articles"
}
}
},
"type": "people",
"id": "3"
} }