rest api – Erratic OAuth 1.0 Signature Mismatch Errors

Question for anyone who might be using OAuth 1.0 to access the REST API (via the official OAuth 1.0 repo).

Small preface to say that I’ve researched this and seen multiple other questions that are similar, but not exactly applicable to my situation. I’ve tried various suggested fixes from multiple sources, searches, and StackExchange and seem to be no closer to a solution.

I’m running into a strange issue where I’m getting sporadic signature mismatch errors. About half the time, my callouts work perfectly (whether from my C# app or Postman), and the other half gets hit with a signature mismatch. I’ve tried a number of things to fix or at least diagnose the issue, none of which work, and all of which seem to be more geared towards issues where OAuth signature errors are consistent every time.

It occurs using the OAuth endpoints (like oauth1/request) but also with other endpoints throughout the API.

"code": "json_oauth1_signature_mismatch",
"message": "OAuth signature does not match",
"data": {
    "status": 401

I’m on the latest stable version of WordPress, but this issue has persisted over a number of releases.

I’m relatively new to the WordPress REST API and to OAuth in general, so I’m unsure if there are server-side logs I can check to dig into the errors more deeply, but from what I can see, my signatures are being generated correctly as the system works intermittently, regardless of whether I’m in my app or using Postman’s signature generation scheme.

My app’s authentication is planned to be based on this API, as well as a number of other callouts at various points to populate data, request access to data, etc. Nailing down a smooth callout process is going to be important to ensure a smooth user experience. Not to mention keeping me sane during development.

Any ideas what would cause these erratic errors when nothing in my code is changing in between executions?

php – Add all post meta data to rest api

I am trying to get all meta fields to automatically add to the rest api. I’ve found a lot of tutorials that mostly deal with adding specific fields only, not all fields. In the wordpress docs I was reading about register_rest_field and a commenter gave a snippet to add all fields but its not working for me. This is the clo

add_action( 'rest_api_init', 'create_api_posts_meta_field' );
function create_api_posts_meta_field() {
    // register_rest_field ( 'name-of-post-type', 'name-of-field-to-return', array-of-callbacks-and-schema() )
    register_rest_field( 'post', 'post-meta-fields', array(
            'get_callback'    => 'get_post_meta_for_api',
            'schema'          => null,
function get_post_meta_for_api( $object ) {
    $post_id = $object('id');

    return get_post_meta( $post_id );

In meta.php I have show_in_rest set to true.

$defaults = array(
        'object_subtype'    => '',
        'type'              => 'string',
        'description'       => '',
        'default'           => '',
        'single'            => true,
        'sanitize_callback' => null,
        'auth_callback'     => null,
        'show_in_rest'      => true,

What else am I missing?

sharepoint server – Unable to access data from external list by REST API

I’m trying to retrieve items from external list by REST API. The external list displays data from SQL Server view. Unfortunately I always get error saying that the list does not exist. This happens both in the case of using api by GUID (like _api/web/lists(guid’96A46528-61AC-4130-8533-67978DAC8A14′)) or by title. I’ve also retrieved all the lists (_api/web/lists) and there’s no list by that ID or title. What could be the reason?
Can Sharepoint version (this is Standard, not Enterprise) have something to do with it?

<m:error xmlns:m="">
<m:code>-2130575322, Microsoft.SharePoint.SPException</m:code>
<m:message xml:lang="pl-PL">Lista nie istnieje. Wybrana strona zawiera nieistniejącą listę. Mogła zostać usunięta przez innego użytkownika.</m:message>

how to write REST API for custom collection in Magento 1.9

I want to create a REST API from MY Custom module
i have created API in Magneto 2 like this Magneto 2 API

Need a reference link of sample module from github

Thank you

shipment – Post tracking in bulk REST API

We are currently create tracking one by one by using POST rest/V1/order/:orderId/ship:

 "notify": true, 
 "tracks": [ 
     "track_number": "1234567890",
     "title": "DPDPRE", 
     "carrier_code": "custom" 


it works fine,
But now we need to POST in Bulk, we have tried /bulk/V1/order/byOrderId/ship:

        "orderId": "284",
        "shipment": {
            "notify": true,
            "tracks": [
                    "track_number": "1234567890",
                    "title": "CODE",
                    "carrier_code": "null"
        "orderId": "285",
        "shipment": {
            "notify": true,
            "tracks": [
                    "track_number": "0987654321",
                    "title": "CODE",
                    "carrier_code": "null"

it ends with no error, but nothing is updated, the following job remains in progress
Thanks for your help

design – Does presentation layer inlcude REST and SOAP services?

Please, consider three pictures, I found in internet:

enter image description here

enter image description here

enter image description here

I always thought, that REST and SOAP services are in service layer – see #1. However, if you look at #2, you’ll see, that presentation layer provides restful service. #3 shows, that presentation layer includes only REST services, but not SOAP.

So, does presentation layer include REST and SOAP services?

.docx files uploaded to SharePoint through REST API being corrupted. Other file types okay

Here is the solution. The below retrieves the contents of a .docx file. My PHP does a search and replace to modify the .docx file before returning the contents. The PHP converts the contents to Base64. The JavaScript then converts this to a blob. Then the Flow accepts the content and runs the SharePoint “Create file” step, successfully creating an uncorrupted .docx file on the SharePoint.


function uploadfile(){
        method: 'POST',
        dataType: 'native',
        url: "generatetemplate.php",
        ContentType: "application/octet-stream",
        data: JSON.stringify({
        success: function(blob){
            var requestdigest = getrequestdigest();
            var filename = "Test.docx";
            blob = "data:application/vnd.openxmlformats-officedocument.wordprocessingml.document;base64,"+blob;
                //Flow Http Request to upload file from local drive
                url: ""+filename+"?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=XXXXXXXXXXXXXXXXXXXXXX",
                method: 'POST',
                ContentType: "octet-stream",
                processData: false,
                data: makeblob(blob)
                console.log("SUCCESS "+JSON.stringify(item));
                console.log("ERROR "+JSON.stringify(error));
makeblob = function (dataURL) {
    var BASE64_MARKER = ';base64,';
    if (dataURL.indexOf(BASE64_MARKER) == -1) {
        var parts = dataURL.split(',');
        var contentType = parts(0).split(':')(1);
        var raw = decodeURIComponent(parts(1));
        return new Blob((raw), { type: contentType });
    var parts = dataURL.split(BASE64_MARKER);
    var contentType = parts(0).split(':')(1);
    var raw = window.atob(parts(1));
    var rawLength = raw.length;
    var uInt8Array = new Uint8Array(rawLength);
    for (var i = 0; i < rawLength; ++i) {
        uInt8Array(i) = raw.charCodeAt(i);
    return new Blob((uInt8Array), { type: contentType });


    function runCurl($url, $post = null, $headers = null, $action = null) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, $post == null ? 0 : 1);
        if($post != null) {
            curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        if($action!=null){curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $action);}
        curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        if($headers != null) {
            curl_setopt($ch, CURLOPT_HEADER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        $response = curl_exec($ch);
        $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        return $response;
    $headers = array(
        "Content-Type: application/json;odata=verbose",
        "Accept: application/json;odata=verbose",
        "Content-Length: 0"
    $data = array("path" => "Test/Test.docx");
    $body = json_encode($data);
    //Flow Http request to get template file .docx file from SharePoint
    $response = runCurl('', $body, $headers, "POST");
    $pks = explode("rnrn",$response);
    $pk = $pks(1);
    file_put_contents("temp/test.docx",$pk); //Save it on the server

    $zip_val = new ZipArchive;
    //Docx file is nothing but a zip file. Open this Zip File
    if($zip_val->open("temp/test.docx") == true){
        $key_file_name = 'word/document.xml';
        $message = $zip_val->getFromName($key_file_name);
        $timestamp = date('d-M-Y H:i:s');
        // this data Replace the placeholders with actual values
       $message = str_replace("timestamp", $timestamp, $message); //Replace string 'timestamp' with the current timestamp variable
        //Replace the content with the new content created above.
        $pk = base64_encode($pk);    //Encode the file binary content in base64
        echo $pk; //Echo the base64 content back to the Ajax call in javascript.js
    } else{

Microsoft Flow

The Compose step below is critical. The Input field is filled with “@{triggerBody()(‘$content’)}” minus the quotation marks.


django rest framework – How to Lazy load datatable with client sided processing?

I have a table with 3500 entries and foreign keys.

I’m using client-sided processing datatables with: django-rest-framework and Ajax.

It takes up to 10 seconds to load.

Is there a way to show the first 10 entries (first page results) – for the user not to think that my website is broken, because it’s taking too long – while the rest of the entries loads in the background?

Also looking for optimizations for the load speed.
Thank you for your time.

Upload Files >250MB via Sharepoint REST API

So I am trying to upload Files to a Sharepoint Site via the REST API. I am already using the /Files/Add() Path-Function, but that one is (from what I’ve found) per design locked to 250MB max and cannot be enlarged, but I would need to upload Files larger than that.

Is there any way I can do this with the Sharepoint REST API?

rest – Should I return user data in an authentication endpoint using JWT?


End points are functions. From this perspective it doesn’t matter what they do as long as the client is aware that this is what will happen, and is happy to deal with the output/outcomes.

So if you write the only client and you have a sequence of six operations that are called in a row, it might make sense to collapse them down into a single call that does it all.

But if you don’t write the only client, then there is a good chance that such complex endpoints will make life harder for them. It would be like trying to get a paper and having to verify that you have medical insurance. Its better to have smaller concise operations to allow these other clients to pick and choose how and when.

A middle ground is to offer a small variety of common chains by opt in.

  • /auth -> just the JWT token
  • /auth?include=user -> JWT token + user details please

As for REST, then yes it matters a lot.

The two graces of REST are that the server doesn’t have to keep connection state, and that intermediaries can cache the result to distribute to their audience to reduce overall load on the server.

JWT tokens don’t fit in this model. You don’t want them cached, you don’t want them shared.

Other data though might be perfectly fine to cache. Perhaps not confidential user data, but if those details were public user information it would be fine.

Mixing the two types eliminates one of the benefits from a REST system. Not the end of the world, but if you are trying to get the scalability it is an anti-pattern.