400 Bad Request when updating list item in SharePoint Online using HttpClient

I have written a REST API which to update the a document metadata in SharePoint. Document resides in a Folder in a Library. I have tried the following code:

var stringData = ("{'__metadata': { 'type': 'SP.Data.IncidentItem' }, 'NameOfUploader': '" + NameOfUploader + "'}");                  client.BaseAddress = new Uri(newurl);                 client.DefaultRequestHeaders.Clear();                 client.DefaultRequestHeaders.Add("Accept", "application/json;odata=verbose");                               client.DefaultRequestHeaders.Add("IF-MATCH", "*");                 //client.DefaultRequestHeaders.Add("X-HTTP-Method", "PATCH");                 client.DefaultRequestHeaders.Add("ContentLength", stringData.Length.ToString());                 client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);                  string FolderUrl = string.Format("_api/web/GetFileByServerRelativeUrl('{0}')/ListItemAllFields", folderServerRelativeUrl + "/" + fileName);                 StringContent strContent = new StringContent(stringData);                 strContent.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json;odata=verbose");                 strContent.Headers.ContentType.Parameters.Add(new NameValueHeaderValue("odata", "verbose"));                 HttpResponseMessage response = client.PatchAsync("_api/web/GetFileByServerRelativeUrl('"+FolderUrl+"')/ListItemAllFields", strContent).Result;                  response.EnsureSuccessStatusCode(); 

I am getting 400 Bad Request at “HttpResponseMessage response“. I have provided all headers, still couldn’t figure it out. I have tried this in POSTMAN with all the headers and this metadata, it’s all working fine. Can Anyone please tell what I am missing?

400 Bad Request “Forbidden”

Estou a testar o Jasmin através da versão demo e já criei a aplicação e correspondente subscrição no nitrogen.

Através dos exemplos do Postman do repositório Github, já consigo obter o access token “client credentials”.

Mas, ao tentar utilizar outros endpoints como, por exemplo, o /billing/invoices disponível também nos Postman samples, recebo sempre um 400 Bad Request com message: “Forbidden”.

Estou a usar o Authorization em forma de Bearer Token.

Aqui vai o body:

GET /api/xxxxxx/xxxxxx-yyyy/billing/invoices HTTP/1.1 Host: my.jasminsoftware.com Content-Type: application/x-www-form-urlencoded Authorization: Bearer zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz User-Agent: PostmanRuntime/7.15.0 Accept: */* Cache-Control: no-cache Postman-Token: d0c5a19c-5448-4c19-b565-f09d80b7b883,3b40913b-1254-4e82-9370-4a9d0e49974d Host: my.jasminsoftware.com accept-encoding: gzip, deflate Connection: keep-alive cache-control: no-cache 

O que poderá estar errado ou a faltar?

TLS Can’t find a Certificate Request during Server Hello

I build a https website and use IIS, I setup SSL settings with Client Certificate to Required, and when I visit the website on browser (chrome), it pops up a client certificate dialog and let me choose one certificate, after I choosing one, and send it to server, the response send back to me.

I use wireshark to capture this process, I can’t find a Certificate Request during the Server Hello, and can’t find the client send certificate.

There are only Server Hello, Certificate, Server Key Exchange, Server Hello Done, and Client Key Exchange, Change Cipher Spec in the next packet.

enter image description here

UPDATE: I test visit https://client.badssl.com/ this site require client certificate, and I find the Certificate Request during Server Hello.

Send and HTTP request to Sharepoint with attachment

I’ve created a flow that will send an email to my group whenever there’s a new request from our SharePoint site.

I would like to add/attach an attachment in sending the email from sharepoint list.

I’ve used HTTP request to Sharepoint. Using this:

Site Address: \sharepoint_site\ Method: POST Uri: _api/SP.Utilities.Utility.SendEmail Headers: accept = application/json;odata=nometadata          content-type = application/json;odata=nometadata Body: {         'properties':{        'To':['email@email.com']        'Body': 'Hello world!'        'Subject': 'Request #1'         }       } 

I don’t how to add the attached file from the list. My goal is on every request we will received an email with attachments and the attached file will be automatically delete when the flow is successful.

Any idea on how it will work?.

thanks in advance.

400 Bad Request “message”: “Forbidden”

Estou a avaliar a API do Jasmin para uma possível integração, mas não estou a conseguir consumir a API.

Efetuei os passos seguintes:

  1. Registei uma Conta no JasminSoftware.com
  2. Acedi à área de Developer https://nitrogen.primaverabss.com/developer/dashboard
  3. Criei uma Subscrição de testes
  4. Criei uma App de testes
  5. Subscrevi a App de testes na Subscrição de testes
  6. Adicionei as coleções do Postman disponibilizadas no Github
  7. Obtive o access_token com sucesso
  8. Tentei consumir vários Endpoints usando o access_token mas sem sucesso
  9. Obtenho sempre a resposta { "message": "Forbidden" }

Log dos pedidos no Postman (informação sensível omitida)

Obtenção do Access Token:

POST /core/connect/token Content-Type: application/x-www-form-urlencoded User-Agent: PostmanRuntime/7.15.0 Accept: */* Cache-Control: no-cache Host: identity.primaverabss.com accept-encoding: gzip, deflate content-length: 120 Connection: keep-alive client_secret=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx&client_id=xxxxxx&scope=application&grant_type=client_credentials  HTTP/1.1 200 status: 200 Cache-Control: no-store, no-cache, max-age=0 Pragma: no-cache Transfer-Encoding: chunked Content-Type: application/json; charset=UTF-8 Content-Encoding: gzip Vary: Accept-Encoding Server: Kestrel Request-Context: appId=cid-v1:17e9b034-971e-4695-a061-0d7084a5a033 X-Powered-By: ASP.NET Date: Tue, 16 Jul 2019 10:05:22 GMT  {"access_token":"XYZ","expires_in":14400,"token_type":"Bearer"} 

Exemplo Lista Faturas


GET /api/222870/222870-0002/billing/invoices/ Content-Type: application/json Authorization: Bearer XYZ User-Agent: PostmanRuntime/7.15.0 Accept: */* Cache-Control: no-cache Postman-Token: fc8bb4a6-5467-46f2-a2fe-84ac81a3a904 Host: my.jasminsoftware.com cookie: xxx accept-encoding: gzip, deflate Connection: keep-alive  HTTP/1.1 400 status: 400 Content-Type: application/json; charset=utf-8 Server: Microsoft-IIS/10.0 Request-Context: appId=cid-v1:07e06186-bc8d-4628-9f1a-465b9a0bb54e X-Powered-By: ASP.NET X-Powered-By: ARR/3.0 Date: Tue, 16 Jul 2019 10:10:23 GMT Content-Length: 30  { "message": "Forbidden" } 

Agradeço a ajuda.

Blog.xsl File Request

I am trying to modify the view from of a default blog. Our company requires to brand the look and feel. I have found several good resources online and they all involve modifying blog.xsl.

This is usually found in program files/common files/microsoft shared/web server extensions/14/template/layouts/xsl

My issue is that we are on SharePoint Online, so we do not have access to this file. Now, I know that via the blog webpart on Posts.aspx, I can set it to use another XSL. My issue is that I do not have the 2013 blog.xsl to start with.

Is there a gentle soul out there to please make it available for download?

How do I create an HTTP PUT request that modifies the resource in many ways

I have a NodeJs backend that interacts with MySQL database. Let us assume that I have a schema similar to this:

Book   id   name   Author   id   book_id   name 

So, I have two tables named Book and Author having 1-M relationship between them such that 1 book can have multiple authors.

Now, I have designed a GET request for a particular book which takes a book_id as a parameter and return its details

  endpoint: http:api.some_domain.com/book/34    response:    {      book_id: 34      name: "Stack Exchange Essentials"      author: [        {          id: 1,          book_id: 34,          name: "John"        },        {          id: 2,          book_id: 34,          name: "Henry"        }      ]   } 

Now, my goal is to design a PUT request for a book resource that will be responsible for:

  1. Updating a book name
  2. Updating the authors’ name
  3. Removing the existing author
  4. Addition of a new author

How do I handle the above problem?

  • Should I create a separate PUT and PATCH requests to handle full and partial update of the resource?

  • Should I handle author deletion in a separate DELETE request

  • If I handle everything in 1 single request, should I expect client to send me the full updated resource?

Please note that I have used Book and Author here for simplicity, but in reality I have different resources. Also note that an Author cannot be directly fetched without a book.

Request and response with multiple backend

We are designing an interface that supports a request and response pattern. The interface shall support multiple backends (that is configurable). Each request to the interface is forwarded to all backends and an aggregated result is returned to caller as response. If one backend fail (error occurred) does not mean the entire request shall fail but mean a partial success. Failure in all backends will mean request failed. We are looking for an open standards, protocol or API that we can use as a reference model for design, terminology and method names and error codes and status types etc.

Appreciate any input.

Enviar archivo desde Curl PHP a servidor MVC y recuperarlo por request

Tengo una pagina con PHP en la que añado un archivo, y tengo que mandarlo, junto con más información a un servicio web en c#.

Mi código actual es

$ datosEnvio = array(DATOS);

$ urlEnvio = ‘URL AL SERVICIO WEB’;

$ contentEnvio = json_encode($ datosEnvio);

$ curlEnvio = curl_init($ urlEnvio);

curl_setopt($ curlEnvio, CURLOPT_HEADER, false);

curl_setopt($ curlEnvio, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ curlEnvio, CURLOPT_HTTPHEADER, array(“Content-type: application/json”));

curl_setopt($ curlEnvio, CURLOPT_POST, true);

curl_setopt($ curlEnvio, CURLOPT_POSTFIELDS, $ contentEnvio);

$ json_responseEnvio = curl_exec($ curlEnvio);

$ statusEnvio = curl_getinfo($ curlEnvio, CURLINFO_HTTP_CODE);

curl_close($ curlEnvio);

Esto se ejecuta en el submit de la pagina, ¿que tengo que modificar para que al servicio web me llegue un archivo que tengo en memoria? A ser posible para recuperarlo por request.

Configure Burp to pass dynamic authentication token from the past response to the next request in intruder

I would like to reuse an authentication token (which is dynamic) between a response and a request in Burp Suite intruder.

By dynamic I mean that the token is invalidated after being sent to the server and that we get a new token in the response.

Here is what is happening: uml-ish_schematic Please note that in the request the token is in the body and that in the response it’s a custom header (Token: x)