Skip to content

create api

Pongstr edited this page Mar 24, 2022 · 1 revision

title: 'Create API' description: '' updated: '2022-03-13T01:08:12.404Z' group: 'API' breadcrumb: ['API'] author: 'RapidAPI'

create API

Request

Request Headers
X-RapidAPI-Key:  6176a4b1b7msh79f63eb622dd69cp1284cdjsn762fc4839b13
X-RapidAPI-Host:  rAPIdAPI-graphqlAPI.p.rAPIdAPI.xyz
Content-Type:  application/json; charset=utf-8
Cookie:  jwt_auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Mzc5MTc0NSwibWFzaGFwZUlkIjoiNWY0NGM5YzMwOGNiMDIxMjNhODc3MWMzIiwib3JpZ2luX3NpdGUiOiJwbGF0Zm9ybS1hcGkiLCJpc05ld1VzZXIiOmZhbHNlLCJpc0F1dGhlbnRpY2F0ZWRCeVNTTyI6ZmFsc2UsImVtYWlsIjpudWxsLCJpYXQiOjE2NDcxMDQ2ODQsImV4cCI6MTY3ODY0MDY4NH0.0O6WT0z5x5CWbnDExjdca3UTWhrANZTyR3AnMS-sdyw; connect.sid=s%3AFRLLS9Tl-mDqOnaR4gsW17uQxc24CJHs.Wd2tZlhb9%2BFnZOHwsjcVQsgNJb%2F1NG6P0Ax0E3HiX8I
GraphQL: Variables
{
  "APICreateInput": {
    "name": "test-27-2",
    "title": "testing API",
    "description": "testing API",
    "category": "Other"
  }
}
GraphQL: Mutation
mutation ($APICreateInput: APICreateInput!) {
  createAPI(API: $APICreateInput) {
    id
    name
    title
    official
    installsAllTime
    requestTimeout
    requestSizeLimit
    installsDaily
    installsMonthly
    installsWeekly
    pricing
    type
    APIType
    currentVersion {
      id
    }
    category
    createdAt
    updatedAt
    fee
    ownerId
    proxy
    status
    description
    longDescription
    tags {
      id
    }
    thumbnail
    thumbnailSmall
    websiteUrl

    termsOfService {
      id
    }
    visibility
    owner {
      id
    }
    score {
      APIId
    }
    followers {
      id
    }
    followersCount
    subscriptionsCount
    issues {
      id
    }
    rating {
      rating
    }
    currentUserRateAPI {
      rating
    }
    slugifiedName
    redirect
    redirectLink
    categoryId
    allowedContext
    APISpotLights {
      id
    }
    patternMatch
    patternMatchAllowOtherTypes
    requestSchemaValidation
    requestSchemaValidationUnknownAttributePolicy
    gateways
    announcements {
      id
    }
    APIDevelopers {
      id
    }
    targetGroups {
      id
    }
    publishAPIPendingRequest
    saveRequestHeadersLogging
    saveRequestQueryParametersLogging
    saveRequestBodyLogging
    saveResponseHeadersLogging
    saveResponseBodyLogging
    useHttpProxy
    security {
      rAPIdAPIProxySecret
    }
    versions {
      id
    }
    headlines {
      id
    }
    endpoints {
      id
    }
    billingFeatures {
      id
    }
    billingItems {
      id
    }
    billingPlans {
      id
    }
  }
}

Example Node Fetch

// Transactions (POST https://rapidapi-graphqlapi.p.rapidapi.xyz/)
fetch('https://rapidapi-graphqlapi.p.rapidapi.xyz/', {
  method: 'POST',
  headers: {
    'X-RapidAPI-Key': 'c33b0aabaemsh10ce5107819f74dp108360jsn31a944d85b38',
    'X-RapidAPI-Host': 'rapidapi-graphqlapi.p.rapidapi.xyz',
    'Content-Type': 'application/json; charset=utf-8',
    Cookie:
      'jwt_auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Mzc5MTc0NSwibWFzaGFwZUlkIjoiNWY0NGM5YzMwOGNiMDIxMjNhODc3MWMzIiwib3JpZ2luX3NpdGUiOiJwbGF0Zm9ybS1hcGkiLCJpc05ld1VzZXIiOmZhbHNlLCJpc0F1dGhlbnRpY2F0ZWRCeVNTTyI6ZmFsc2UsImVtYWlsIjpudWxsLCJpYXQiOjE2NDcxMDQ2ODQsImV4cCI6MTY3ODY0MDY4NH0.0O6WT0z5x5CWbnDExjdca3UTWhrANZTyR3AnMS-sdyw; connect.sid=s%3AFRLLS9Tl-mDqOnaR4gsW17uQxc24CJHs.Wd2tZlhb9%2BFnZOHwsjcVQsgNJb%2F1NG6P0Ax0E3HiX8I',
  },
  body: '{\n\t"query": "query transactions($pagination:PaginationInput,$where:TransactionsWhereInput){transactions(pagination:$pagination,where:$where){nodes{id totalAmount additionalAmount refunded paid payoutAmount periodStart periodEnd invoiceLink refundDate refundedAmount mashapeId status createdAt userId apiId paidout chargeId disputed stripeId}}}",\n\t"variables": {\n\t\t"pagination": {\n\t\t\t"first": 50\n\t\t},\n\t\t"where": {\n\t\t\t"userId": "3791745",\n\t\t\t"withCharges": false,\n\t\t\t"queryFilters": {\n\t\t\t\t"filters": [\n\t\t\t\t\t{\n\t\t\t\t\t\t"columnName": "paidout",\n\t\t\t\t\t\t"operand": "$in",\n\t\t\t\t\t\t"value": [\n\t\t\t\t\t\t\t"true",\n\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t"1"\n\t\t\t\t\t\t]\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t}\n\t}\n}',
})
  .then((res) => res.text())
  .then(console.log.bind(console))
  .catch(console.error.bind(console))

Response

Response Headers
Request URL: https://rAPIdAPI-graphqlAPI.p.rAPIdAPI.xyz/
Status Code: HTTP/1.1 200 OK

Content-Type:  application/json; charset=utf-8
Access-Control-Allow-Origin:  *
Set-Cookie:  jwt_auth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6Mzc5MTc0NSwibWFzaGFwZUlkIjoiNWY0NGM5YzMwOGNiMDIxMjNhODc3MWMzIiwib3JpZ2luX3NpdGUiOiJwbGF0Zm9ybS1hcGkiLCJpc05ld1VzZXIiOmZhbHNlLCJpc0F1dGhlbnRpY2F0ZWRCeVNTTyI6ZmFsc2UsImVtYWlsIjpudWxsLCJpYXQiOjE2NDY5ODgyNzQsImV4cCI6MTY3ODUyNDI3NH0.R5CVWTNBoqO_5Zw4_3cuaeC3DsaNUjGtlr5SZo8C2Gg; Max-Age=31536000; Path=/; Expires=Sat, 11 Mar 2023 08:44:34 GMT; HttpOnly; Secure; SameSite=Strict, connect.sid=s%3AFRLLS9Tl-mDqOnaR4gsW17uQxc24CJHs.Wd2tZlhb9%2BFnZOHwsjcVQsgNJb%2F1NG6P0Ax0E3HiX8I; Path=/; Expires=Sat, 11 Mar 2023 08:44:36 GMT; HttpOnly
Server:  RapidAPI-1.2.8
X-Download-Options:  noopen
X-Correlation-Id:  021661cb-661e-427a-8587-2fdfea0c9cc2
X-XSS-Protection:  1; mode=block
X-RapidAPI-Region:  AWS - us-east-1
Date:  Fri, 11 Mar 2022 08:44:36 GMT
Strict-Transport-Security:  max-age=15552000; includeSubDomains
X-RapidAPI-Version:  1.2.8
Content-Length:  2010
Connection:  Close
X-Content-Type-Options:  nosniff
Etag:  W/"7da-TiOAPvcSttVlgDiLBX+dYpAmvno"
X-DNS-Prefetch-Control:  off
X-Frame-Options:  SAMEORIGIN

Response Body
{
  "data": {
    "createAPI": {
      "id": "API_48103781-7e08-4dcb-835f-11f79464513a",
      "name": "test-11-3",
      "title": "testing API",
      "official": null,
      "installsAllTime": 0,
      "requestTimeout": null,
      "requestSizeLimit": null,
      "installsDaily": 0,
      "installsMonthly": 0,
      "installsWeekly": 0,
      "pricing": "FREE",
      "type": "API",
      "APIType": "http",
      "currentVersion": {
        "id": "API Version_a763ea0a-9a8a-402a-8d66-5d6a28650461"
      },
      "category": "Other",
      "createdAt": "1646988275164",
      "updatedAt": "1646988275561",
      "fee": null,
      "ownerId": 3791745,
      "proxy": true,
      "status": "ACTIVE",
      "description": "testing API",
      "longDescription": "",
      "tags": [],
      "thumbnail": "https://rAPIdAPI-stage-APIs.s3.amazonaws.com/117d4ed8-e27e-4051-8a39-82e29a4c1e36.png",
      "thumbnailSmall": "https://rAPIdAPI-stage-APIs.s3.amazonaws.com/dec4bc1e-2c30-4c76-9945-5b6748b3f2f4.png",
      "websiteUrl": "",
      "termsOfService": null,
      "visibility": "PRIVATE",
      "owner": {
        "id": "3791745"
      },
      "score": null,
      "followers": [],
      "followersCount": 0,
      "subscriptionsCount": 0,
      "issues": [],
      "rating": {
        "rating": 0
      },
      "currentUserRateAPI": {
        "rating": 0
      },
      "slugifiedName": "test-11-3",
      "redirect": null,
      "redirectLink": null,
      "categoryId": "category_a343890c-7a81-4c43-9e6b-29fe1c0d6193",
      "allowedContext": ["3791745"],
      "APISpotLights": [],
      "patternMatch": null,
      "patternMatchAllowOtherTypes": null,
      "requestSchemaValidation": false,
      "requestSchemaValidationUnknownAttributePolicy": null,
      "gateways": null,
      "announcements": [],
      "APIDevelopers": [
        {
          "id": "APIdeveloper_2a6c8817-65e5-420f-a8fd-f7573bb6a6cc"
        }
      ],
      "targetGroups": null,
      "publishAPIPendingRequest": false,
      "saveRequestHeadersLogging": true,
      "saveRequestQueryParametersLogging": true,
      "saveRequestBodyLogging": true,
      "saveResponseHeadersLogging": true,
      "saveResponseBodyLogging": true,
      "useHttpProxy": false,
      "security": {
        "rAPIdAPIProxySecret": "7aac3a70-a117-11ec-9577-b3a508382922"
      },
      "versions": [
        {
          "id": "API Version_a763ea0a-9a8a-402a-8d66-5d6a28650461"
        }
      ],
      "headlines": [],
      "endpoints": [],
      "billingFeatures": [],
      "billingItems": [
        {
          "id": "billingitem_192be6eb-12de-4e9a-9fe5-b11f97e0ee75"
        }
      ],
      "billingPlans": [
        {
          "id": "billingplan_27c8c5d6-ba55-4e31-bef1-2cbb2c743f29"
        }
      ]
    }
  }
}
Clone this wiki locally