# Push data from one API to another API

**URL:** <https://community.postman.com/t/push-data-from-one-api-to-another-api/20858>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [February 26, 2021, 5:07pm UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858 "2021-02-26T17:07:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luke](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/luke/32/7485_2.png) [@luke](https://community.postman.com/u/luke)\
**Post date:** [February 26, 2021, 5:07pm UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858/1 "2021-02-26T17:07:44Z")

</div>

Hi, glad to be here & learn all about API’s and Postman 🙂

Here’s what I’m trying to accomplish:

1. `GET` data from [Timing App’s](https://web.timingapp.com/docs/#introduction) API ( **DONE** , _testing only_)
2. `POST` that data into my invoicing app [Wave](https://developer.waveapps.com/hc/en-us/sections/360006441372-Examples) to create an invoice. ( **DONE** , _testing only_)

What I am unclear on is how to migrate/transfer/move the data (`duration` of hours, `title` or client name) from the `GET` in step 1 to the `POST` in step 2. I can `POST` to Wave and an invoice is created but only with testing code. I am yet to actually merge the `GET` & `POST` data from actual tracked hours to an actual new invoice.

**GET**  
`https://web.timingapp.com/api/v1/time-entries?include_project_data=true`  
Below is an example of `GET` results from [Timing App’s API docs](https://web.timingapp.com/docs/#return-a-list-of-tasks).

```auto
{
    "data": [
        {
            "self": "/time-entries/3466676958206930176",
            "start_date": "2021-02-25T23:17:26.550757+00:00",
            "end_date": "2021-02-25T23:32:48.353939+00:00",
            "duration": 921.803182,
            "project": {
                "self": "/projects/1582482660025863380",
                "membership_id": null,
                "title": "CLIENT NAME",
                "title_chain": [
                    "CLIENT NAME"
                ],
                "color": "#8C4F00FF",
                "productivity_score": 1,
                "is_archived": false,
                "parent": null
            },
            "title": null,
            "notes": null,
            "is_running": false,
            "creator_name": "example@example.com"
        }, . . .

```

**POST**  
`https://gql.waveapps.com/graphql/public`  
Below is an example of `POST` results from [Wave API Create Invoice docs](https://developer.waveapps.com/hc/en-us/articles/360038817812-Mutation-Create-invoice).

```auto
{
    "data": {
        "invoiceCreate": {
            "didSucceed": true,
            "inputErrors": null,
            "invoice": {
                "id": "QnVzaW5lc3M6YTgyMmRlZDktNjBhYS00NGE2LWJiN2EtYzAxM2VjNjRmMmJkO0ludm9pY2U6MTE0MzYzNjU5MTc2ODYxMjAwMQ==",
                "createdAt": "2021-02-26T16:12:19.584Z",
                "modifiedAt": "2021-02-26T16:12:19.641Z",
                "pdfUrl": "https://example.com",
                "viewUrl": "https://example.com",
                "status": "DRAFT",
                "title": "Invoice",
                "subhead": "",
                "invoiceNumber": "149",
                "invoiceDate": "2021-02-26",
                "poNumber": "",
                "customer": {
                    "id": "QnVzaW5lc3M6YTgyMmRlZDktNjBhYS00NGE2LWJiN2EtYzAxM2VjNjRmMmJkO0N1c3RvbWVyOjI1NDk3MzAx",
                    "name": "CLIENT NAME"
                },
                "currency": {
                    "code": "USD"
                },
                "dueDate": "2021-03-13",
                "amountDue": {
                    "value": "1.00",
                    "currency": {
                        "symbol": "$"
                    }
                },
                "amountPaid": {
                    "value": "0.00",
                    "currency": {
                        "symbol": "$"
                    }
                },
                "taxTotal": {
                    "value": "0.00",
                    "currency": {
                        "symbol": "$"
                    }
                },
                "total": {
                    "value": "45.00",
                    "currency": {
                        "symbol": "$"
                    }
                },
                "exchangeRate": "1",
                "footer": "Thank you very much!",
                "memo": "",
                "disableCreditCardPayments": true,
                "disableBankPayments": false,
                "itemTitle": "Services",
                "unitTitle": "Hours",
                "priceTitle": "Per Hour",
                "amountTitle": "Total",
                "hideName": false,
                "hideDescription": false,
                "hideUnit": false,
                "hidePrice": false,
                "hideAmount": false,
                "items": [
                    {
                        "product": {
                            "id": "QnVzaW5lc3M6YTgyMmRlZDktNjBhYS00NGE2LWJiN2EtYzAxM2VjNjRmMmJkO1Byb2R1Y3Q6MzA1MzA5NzM=",
                            "name": "Plugin Issues"
                        },
                        "description": "Hrs from 02/27/19 to 05/30/19",
                        "quantity": "1",
                        "price": "1",
                        "subtotal": {
                            "value": "1.00",
                            "currency": {
                                "symbol": "$"
                            }
                        },
                        "total": {
                            "value": "1.00",
                            "currency": {
                                "symbol": "$"
                            }
                        },
                        "account": {
                            "id": "QWNjb3VudDo0MjMxMTU1NTE2MzI1NjQ0Njc7QnVzaW5lc3M6YTgyMmRlZDktNjBhYS00NGE2LWJiN2EtYzAxM2VjNjRmMmJk",
                            "name": "Sales",
                            "subtype": {
                                "name": "Income",
                                "value": "INCOME"
                            }
                        },
                        "taxes": []
                    }
                ],
                "lastSentAt": null,
                "lastSentVia": "NOT_SENT",
                "lastViewedAt": null
            }
        }
    }
}

```

I hope my explanation makes sense of what I’m trying to do 🙃

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [February 26, 2021, 5:51pm UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858/2 "2021-02-26T17:51:26Z")

</div>

Hi @luke, Welcome to the community!

It seems you are trying to do the integration and transformation logic from POSTMAN.

One way to do is, to have 2 requests created (GET, POST). Within GET request you, transform your response to the request structure of POST request using javascript and then store it to either, global, environment or collection variables.

```
const mark1 = <JSON Transformed DATA>;
pm.set.environment("inputToPOST",mark1);

```

In the POST request you may use the same variable set in the previous response from GET response, as body.  
`{{inputToPOST}}`

Hope it helps!

---

<div class="post-metadata">

**Author:** ![praveendvd](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/praveendvd/32/6796_2.png) [@praveendvd](https://community.postman.com/u/praveendvd)\
**Post date:** [February 27, 2021, 2:40pm UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858/3 "2021-02-27T14:40:40Z")

</div>

> [@pranavdavar](#):
>
> `pm.set.environment("inputToPOST",mark1);`

make sure you stringify the request as the request body expects a string

```
  pm.set.environment("inputToPOST",JSON.stringify(mark1));

```

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [February 27, 2021, 2:53pm UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858/4 "2021-02-27T14:53:57Z")

</div>

Thank you @praveendvd for correcting that one

---

<div class="post-metadata">

**Author:** ![mission-observer-496](https://avatars.discourse-cdn.com/v4/letter/m/a88e57/32.png) [@mission-observer-496](https://community.postman.com/u/mission-observer-496)\
**Post date:** [December 5, 2022, 10:05am UTC](https://community.postman.com/t/push-data-from-one-api-to-another-api/20858/5 "2022-12-05T10:05:19Z")

</div>

Hi guys, I am new to apis and postman, so I would love any blog resources or anything really that can help explain moving information from an old crm to a new hubspot account. Looking forward to your input.
